Exception information: 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 filter, which initializes the struts dispatcher needed for this tag.
Environment: Tomcat 6.0 struts2.21
Web. xml configuration:
<filter> <filter-name>struts2</filter-name> <filter-class> org.apache.struts2.dispatcher.ng.filter.StrutsPrepar eAndExecuteFilter </filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>*.action</url-pattern> </filter-mapping>
By default, the. Action filter is performed. In the past, freemarker was used as the display end. No error occurred. Now, this error occurs when JSP is used to display something.
Test. jsp:
<% @ Page Language = "Java" contenttype = "text/html; charset = UTF-8 "pageencoding =" UTF-8 "%> <% @ taglib prefix =" S "uri ="/Struts-tags "%> <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <HTML xmlns = "http://www.w3.org/1999/xhtml">
The struts2 tag has been introduced, and the following methods are summarized after the query:
1. set the web. the struts2 filter in XML is filtered from. change Action to/*. However, this method is not very good. You should filter all the items by default, which may cause troubles for some applications, such
Fck Configuration
2. Modify the test. jsp file without using the struts tag.
3. Add another filter in the web. xml configuration file:
<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>