Struts label Error The struts dispatcher cannot be found.

Source: Internet
Author: User

The Struts dispatcher cannot be found. This are usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the struts Dispatche R needed for this tag. -[Unknown Location]
At Org.apache.struts2.views.jsp.TagUtils.getStack (tagutils.java:60)
At Org.apache.struts2.views.jsp.StrutsBodyTagSupport.getStack (strutsbodytagsupport.java:44)

The original use of labels, the reference method is the default configuration:

Web.xml: <filter> <filter-name>struts2</filter-name> <filter-class> Org.apache. Struts2.dispatcher.FilterDispatcher </filter-class> </filter> <filter-mapping> <f Ilter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>

Reference in page: <%@ taglib prefix= "s" uri= "/struts-tags"%>

Due to the relationships of some special applications in the Web application used, the Web.xml configuration is changed to: <filter> <filter-name>struts2</filter-name> <FILTER-CLA ss> org.apache.struts2.dispatcher.FilterDispatcher </filter-class> </filter> <taglib > <taglib-uri>struts-tags</taglib-uri> <taglib-location>/web-inf/struts2-core-2.0.11.jar </taglib-location> </taglib> <filter-mapping> <FILTER-NAME>STRUTS2</FILTER-NAME&G       T <url-pattern>/*.action</url-pattern> </filter-mapping>

Let the Sturts filter accept only the suffix name Action request and configure the Struts tab to the Web.xml file.

In use, however, direct access to index.jsp occurs with an exception: the Struts dispatcher cannot be found. This are usually caused by using Struts tags without the associated filter. Strut s tags are only usable while the request has passed through its servlet filter, which initializes the Struts Dispa Tcher n eeded for this tag. -[Unknown Location]

Cannot use JSP directly in Struts2, reference struts2 label. Is there a way to solve it?

To find a solution, in fact, just add a filter settings on it: <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>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.