Path struts.xml and web.xml

When I use eclipse to develop struts2. I found that the struts.xml file can be placed in the src folder or WebContent \ WEB-INF \ classes. Both ways are fine.

Who cares? what's better? Does a different path affect performance or another thing? Is there any other way for struts.xml file?

And can web.xml be placed in WebContent \ WEB-INF? Or any other way for web.xml?

+4
source share
1 answer
  • From the point of view of the web application there is no difference: it is expected that struts.xml will be at the root of the class path after deployment. How and when this happens does not matter.

  • Putting the configuration file in the source directory is better because you do not need to manage the class directory itself. Tools such as Maven move artifacts from the src/main/resources project directory to the class path. It will not move the XML file from src/main/java unless it is specifically configured for this.

  • No.

  • You can override the default location. There is rarely a good reason; Then no. If you use several configuration files, they can be placed in packages, but I would leave them in the class path.

  • This is a completely unrelated question, but it should remain in the default location, WEB-INF . WebContent is project WebContent (Eclipse). You will need to configure the deployment / packaging process to find it.

+5
source

All Articles