Reputation: 73
I'm new to struts.
I made an index.jsp page that has an href to an action that loads another JSP. I simply want to have a link that a user can click to go to another JSP.
I am getting the error : The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet
Please see this imgur album for screenshots of the project/code:
Thank you in advance.
Upvotes: 0
Views: 389
Reputation: 56
you should add the code to your web.xml
:
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/action/*</url-pattern>
</filter-mapping>
Upvotes: 0
Reputation: 160181
The error message says it all–many (all?) S2 tags expect to be called only on pages displayed as the result of executing an action.
If you are linking from one bare JSP to another just use a link tag; there's no S2 functionality involved at all, and no need to involve S2 tags.
It should be rare to hit a "bare" JSP page in an S2 app at all. At most you might have a landing page that redirects to an action.
Upvotes: 1