【发布时间】:2020-05-03 17:18:02
【问题描述】:
我有两个 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: The Struts dispatcher cannot be found.).
如果从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 标签的应用程序?
【问题讨论】: