Java 无法在struts2中识别筛选器标记
我对struts2很陌生,我正在努力跟随一个新的方向。我正在使用Eclipse和Tomcat服务器来运行应用程序 无法识别我的筛选器标记,并且未调用相应的操作文件。当我尝试运行应用程序时Java 无法在struts2中识别筛选器标记,java,eclipse,struts2,filter,web.xml,Java,Eclipse,Struts2,Filter,Web.xml,我对struts2很陌生,我正在努力跟随一个新的方向。我正在使用Eclipse和Tomcat服务器来运行应用程序 无法识别我的筛选器标记,并且未调用相应的操作文件。当我尝试运行应用程序时 http://localhost:8080/Struts2Starter 它只是说“请求的资源不可用” 我已经下载了相应的struts2 jar文件,并将它们指向WEB-INF/lib 我的web.xml如下 <?xml version="1.0" encoding="UTF-8"?> <w
http://localhost:8080/Struts2Starter
它只是说“请求的资源不可用”
我已经下载了相应的struts2 jar文件,并将它们指向WEB-INF/lib
我的web.xml
如下
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>Struts2Starter</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.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>
</web-app>
Struts2Starter
支柱2
org.apache.struts2.dispatcher.ng.filter.strutspreadexecutefilter
支柱2
/*
index.jsp
我的struts.xml如下所示,它位于类路径(src文件夹)中
/success.jsp
我真的不确定我遗漏了什么。有人能帮我解决吗?在操作配置中无法识别类
org.kowshik.action.TutorialAction
。您应该检查与action类对应的包的名称
您已经从web内容的根目录启动了应用程序。这意味着,如果您的根文件夹有一个index.jsp
,那么web服务器将使用它,而不管您在过滤器映射中配置它时struts如何过滤它。该文件内容中最有用的部分是重定向到功能齐全的struts操作。比如说
<% response.sendRedirect("getTutorial.action"); %>
启动期间或请求时是否有任何错误?没有。我根本没有收到任何错误。@Sruthi如果您没有收到任何错误,则您很好,并且资源不可用,因为没有此类资源。要么让struts处理资源,要么让web服务器处理。目前没有其他选项可用,您应该知道这一点。什么是“无法识别筛选器标记”?您需要将调试模式设置为true,将日志记录设置为debug,并在启动时查看日志。我的项目中有相应包中的类TutorialAction。我在根文件夹中有一个index.jsp,它没有被调用,而是抛出一个异常。每当我在web.xml中包含filter时,请求的资源不可用。请检查服务器日志,确认应用程序已启动,并且它拥有资源。
<% response.sendRedirect("getTutorial.action"); %>
<constant name="struts.convention.action.disableScanning" value="true" />