Issue
I am new to Struts and I have to add a functionality to a legacy system.
I have to create a servlet that's required to be accessed from a JSP page. I created one and added servlet-mapping in the web.xml file but it always shows an error like the following:
There is no Action mapped for namespace [/myServlet] and action name
[test] associated with context path [/MyProject]
I have searched for the solution but the one I got here is for the sturts.xml entry and I am not using the struts.xml, rather I am using the annotations.
Could someone please tell me how to use excludePattern
in a annotations based Struts2 project?
NOTE: I tried adding the exclue-pattern in my web.xml like this:
<init-param>
<param-name>struts.action.excludePattern</param-name>
<param-value>/FileUploadServlet</param-value>
</init-param>
But it's still not working.
Solution
Well, I have solved the problem by adding struts.xml to my project and adding only the constant there like this:
<constant name="struts.action.excludePattern" value="/MyServlet"/>
I was first wondering that I will have to provide all the mappings manually instead of the annotations but it worked without doing so.
Answered By - ahmar hashmi