Kimberly L
Kimberly L

Reputation: 73

Struts 2 - URL tag not going through dispatcher

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:

Link to my project

Thank you in advance.

Upvotes: 0

Views: 389

Answers (2)

Beniamin
Beniamin

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

Dave Newton
Dave Newton

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

Related Questions