weixin_42349194
2009-11-18 11:47 阅读 291
已采纳

Strust2项目中使用servlet的问题

项目中一Strust2为主,但是一个功能需要直接使用Servlet来实现,
配了映射:

UploadPhoto
/servlet/UploadPhoto

但是好像被Strust2截获了,报错如下:

Messages: There is no Action mapped for action name UploadPhoto.

Stacktraces
There is no Action mapped for action name UploadPhoto. - [unknown location]

com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:178)
org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:478)
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
java.lang.Thread.run(Thread.java:619)

[b]
[size=large]查了一些文档都没有提到,请问各位有没有类似经验的,如何处理?[/size][/b]

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

3条回答 默认 最新

  • 已采纳
    herowzz herowzz 2009-11-19 10:49

    你的struts2的拦截器肯定是配置成拦截所有请求了

    改成这样
    [code="java"]

    struts2

    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter



    struts2
    *.action

    [/code]

    设置url-pattern为只拦截点action结尾的就可以了

    点赞 评论 复制链接分享
  • cwx714 紫翎观星 2009-11-18 14:08

    映射改为:

    UploadPhoto
    /servlet/UploadPhoto.servlet

    用 http://localhost:8080/XXX/servlet/UploadPhoto.servlet来访问试试。

    点赞 评论 复制链接分享
  • fang_fumin fang_fumin 2009-11-18 15:00


    Servlet名称
    Servlet类路径


    Servlet名称(和标签中中相同)
    页面访问的URL路径

    你因该是UploadPhoto对应的标签中中配置的类路径或者类的格式不对(即没有继承HttpServlet)

    点赞 评论 复制链接分享

相关推荐