开发者社区> 问答> 正文

struts配置web.xml提示StrutsPrepareAndExecute?报错

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="main\java\action\HelloAction" 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";
}
}


展开
收起
爱吃鱼的程序员 2020-06-10 14:56:09 625 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    class="main\java\action\HelloAction"

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

    或者spring继承


    哦,sorry,失误。。。。。IntellijIDE
    2020-06-10 14:56:24
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
Web应用系统性能优化 立即下载
高性能Web架构之缓存体系 立即下载
PWA:移动Web的现在与未来 立即下载