我有两个 JSP 文件:
-
index.jsp
(没有 Struts 2 标签) -
login.jsp
(带有 Struts 2 标签)
我已链接到login.jsp
至index.jsp
与 <a href="login.jsp">LOGIN IN</a>
标签。
单击时页面不会加载,而是抛出错误:
(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 标签的应用程序?
最佳答案
如果页面上有 S2 标记,则必须通过操作才能到达该页面。
S2 标签需要来自框架的数据。
关于java - 贾斯珀异常(exception)。找不到 Struts 调度程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61578658/