I am new to Struts2 and I am working on a simple project that helps me to learn. I started with my Struts.xml
file with the S
capitalized. When I run it, I get my web page as expected with a couple fields and a submit button. When I fill them in and click submit, I get a 404 error saying:
There is no Action mapped for namespace [/] and action name [MyAction] associated with context path [/MyProject]
I did some research and found a suggestion to change Struts.xml
to struts.xml
just by changing the s
from lowercase to uppercase. When I did this and ran my project, I no longer even get to my first page. I just get the 404 error as it's trying to look for my index.jsp
. Any ideas on why changing struts.xml
to lowercase is causing more problems than it's fixing?
My struts.xml
file is in WebContent/WEB-INF/classes
. My index.jsp
in under WebContent
.
Here is my struts.xml
code
<strtus>
<constant name="struts.devMode" value="true" />
<package name="default" extends="struts-default">
<action name="MyAction"
class="com.Foo.MyAction"
method="execute">
<result name="success">/showTable.jsp</result>
</action>
</package>
</strtus>
Your struts.xml file should be in src folder. So change the file location to ProjectName/src with the file name struts.xml not Struts.xml.
Thanks, Amit Kumar