当前位置: 代码迷 >> J2EE >> struts提示路径异常运行不起来
  详细解决方案

struts提示路径异常运行不起来

热度:37   发布时间:2016-04-22 00:24:45.0
struts提示路径错误运行不起来
[code=Java][/code]struts.xml配置
Java code
<?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="jason" namespace="/test" extends="struts-default">        <action name="hello" class="action.HelloWordAction"  method="execute">            <result name="success">/page/hello.jsp</result>        </action>    </package></struts>


web.xml配置
Java code
<?xml version="1.0" encoding="UTF-8"?><web-app version="2.4"     xmlns="http://java.sun.com/xml/ns/j2ee"     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee     http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">  <welcome-file-list>    <welcome-file>index.jsp</welcome-file>  </welcome-file-list>    <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>/*</url-pattern>  </filter-mapping></web-app>


HelloWordAction
Java code
package action;public class HelloWordAction{    public String message;    public String getMessage()    {        return message;    }    public String execute()    {        message = "Hello Word!";        return "success";    }}


运行信息:
2012-10-21 21:15:02 org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Program Files\MyEclipse 6.5\bin;D:\Program Files\Tomcat 6.0\bin
2012-10-21 21:15:02 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2012-10-21 21:15:02 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 871 ms
2012-10-21 21:15:02 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2012-10-21 21:15:02 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.18
2012-10-21 21:15:04 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Parsing configuration file [struts-default.xml]
2012-10-21 21:15:04 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Unable to locate configuration files of the name struts-plugin.xml, skipping
2012-10-21 21:15:04 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Parsing configuration file [struts-plugin.xml]
2012-10-21 21:15:05 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Parsing configuration file [struts.xml]
2012-10-21 21:15:07 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Parsing configuration file [struts-default.xml]
2012-10-21 21:15:07 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Unable to locate configuration files of the name struts-plugin.xml, skipping
2012-10-21 21:15:07 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Parsing configuration file [struts-plugin.xml]
  相关解决方案