英文:
jasper exception. The Struts dispatcher cannot be found
问题
我有两个JSP文件:
index.jsp
(没有Struts 2标签)login.jsp
(带有Struts 2标签)
我用<a href="login.jsp">LOGIN IN</a>
标签将login.jsp
链接到index.jsp
。
当点击时,页面不加载,而是抛出错误:
(ERROR:org.apache.jasper.JasperException: 找不到Struts分派程序。).
如果从login.jsp
中移除所有的Struts标签,它就能正常工作。
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
</web-app>
如何在带有Struts 2标签的情况下运行我的应用程序?
英文:
I have two JSP files:
index.jsp
(with no Struts 2 tags)login.jsp
(with Struts 2 tags)
I have linked to login.jsp
to index.jsp
with <a href="login.jsp">LOGIN IN</a>
tag.
When clicked the page doesn't load, instead throws the error:
(ERROR:org.apache.jasper.JasperException: The Struts dispatcher cannot be found.).
If all the struts tag are removed from login.jsp
it works fine.
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
</web-app>
How to run my application with Struts 2 tags on it?
答案1
得分: 0
如果页面上有S2标签,则必须通过操作来访问。
S2标签期望来自框架的数据。
英文:
If there are S2 tags on a page it must be reached via an action.
S2 tags expect data from the framework.
专注分享java语言的经验与见解,让所有开发者获益!
评论