a) In Struts2, how does it find struts.xml?? (we dont define struts.xml in web.xml file unlike in Struts1 which we define struts-config.xml in web.xml file, so how its going to see that struts.xml file)
I want my struts.xml file to have a different name like learn-struts.xml, how should I explicitly specify in web.xml ? Can someone please let me know the XML configuration ?
I tried using the following but did not work:
Welcome to the JavaRanch.
You cannot change the name of struts.xml. You can, however, break up the Struts configuration among several configuration files which are named in strtus.xml.
Struts 2 FAQ: Configuration files
I believe that the struts.xml file needs to reside in the classpath. My client required that the struts.xml file not be stored under the application server's directories. To handle this, we specified the directory that they wanted to use as part of the class path in the application server's configuration for our server instance.
Tom Rispoli wrote:I believe that the struts.xml file needs to reside in the classpath.
That's what the FAQ I linked to says
As for how to set the server classpath, that depends on the server. This is a Bad Idea for two reasons (off the top of my head). First, deviating from the standard will confuse developers who later have to maintain the application. They expect struts.xml to be in WEB-INF/classes. Why make things difficult? Second, what happens when someone tries to deploy a second Struts application on the server?
Joined: Aug 29, 2008
Oops, should have read more closely, sorry for the duplicate reply.
Tom Rispoli wrote:Oops, should have read more closely, sorry for the duplicate reply.
My comment wasn't directed at you
Neither is my critique of changing the server classpath. That's what the client wants, that's what we do. Of course, we should also let them know the impact of such a choice.
subject: STRUTS 2 : How to explicitly specify struts.xml in web.xml ?