struts.xml配置错误,出现了问题

wangxuxu 发布于 2016/09/23 18:31
阅读 229
收藏 0

出现问题如下:

警告: Could not find action or result: /RequireManagement/action/RequirementAction
There is no Action mapped for action name RequirementAction. - [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:37)
    at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
    at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:557)
    at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:81)
    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:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:619)

我的struts.xml配置文件如下:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
    <package name="action"  extends="struts-default">
        <action name="addRequirement" class="action.RequirementAction" method="addRequirement">
            <result name="success">success.jsp</result>
            <result name="error">error.jsp</result>
        </action>
    </package>
</struts>

我的jsp文件如下:

  <body>
      <form  name="addRequirement" action="action/RequirementAction" method="post" style={text-align:center}>
          <p>增加需求</p>
        <input type="text" name="requirementId" value="" ><br>
        <input type="text" name="requirementName" value="" >
        <br>
        <input type="submit" value="提交" >
      </form>
  </body>

希望小伙伴能够解答,谢谢了!!!

加载中
0
pantrick
pantrick
actionName 要是RequirementAction 并且要配置namespace='action'
0
Adairs
Adairs
form的action应该是action/addRequirement,要个struts中配置的保持一致
返回顶部
顶部