求解:struts2出现个诡异的问题

(1)做这个只是为了测试一下struts2的使用,但在运行index.jsp进行跳转的时候出现

2011-5-6 15:20:02 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
警告: Could not find action or result
There is no Action mapped for action name input. - [unknown location]
 at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189)
 at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
 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:475)
 at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
 at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
 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:102)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
 at java.lang.Thread.run(Thread.java:619)
在网络里看了很久,但没找到适合的方法,希望大哥们帮帮忙啊!

struts-2.2.1.1

jar包:

commons-fileupload-1.2.1.jar

commons-io-1.3.2.jar

commons-logging-1.0.4.jar

freemarker-2.3.16.jar

javassist-3.7.ga.jar

ognl-3.0.jar

struts2-core-2.2.1.1.jar

xwork-core-2.2.1.1.jar

(2)src/struts.xml

<!DOCTYPE struts PUBLIC
          "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
          "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="default" extends="struts_default" namespace="/test">
<action name="input" class="test.action.TestAction" method="test">
<result name="success">/s.jsp</result>
</action>
</package>
</struts>

(3)web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
 xmlns="http://java.sun.com/xml/ns/javaee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
 http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
 <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>*.action</url-pattern>
 </filter-mapping>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
</web-app>
(4)Action 类

package test.action;

import com.opensymphony.xwork2.ActionSupport;
 
public class TestAction extends ActionSupport{
 /**
  *
  */
 private static final long serialVersionUID = 1L;

 public String test()
 {
  return "success";
 }

}

(5)index.jsp
  <body>
   <a href="test/input.action">testTos.jsp</a>
  </body>

 

你可能感兴趣的:(求解:struts2出现个诡异的问题)