struts配置web.xml提示StrutsPrepareAndExecuteFilter' is not assignable to 'javax.servlet.Filter

发布于 2021-11-28 05:43:07 字数 2860 浏览 730 评论 2

struts配置web.xml提示 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter' is not assignable to 'javax.servlet.Filter

导入的包和报错情况如下:

项目运行报错
WARNING: Could not find action or result
There is no Action mapped for namespace [/] and action name [learn] associated with context path []. - [unknown location]
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)
at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:553)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:617)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1778)
at java.lang.Thread.run(Thread.java:724)


struts配置如下
    <package name="xxx" extends="struts-default">
    <action name="learn" class="mainjavaactionHelloAction" method="execute">
        <result name="success">/success.jsp</result>
    </action>
</package>

HelloAction.java文件如下:

public class HelloAction extends ActionSupport{
@Override
public String execute() throws Exception {
System.out.println("正在访问action");
return "success";
}
}


如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

苍暮颜 2021-11-30 23:33:16

哦,sorry,失误。。。。。

凡尘雨 2021-11-28 20:29:46

class="mainjavaactionHelloAction"

哪里看看到类名用反斜杠这种写法的,class="main.java.action.HelloAction"

或者spring 继承

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文