struts2的xml内result导致项目访问404问题

运性环境是:
       myeclipse5.5
      tocamt 5.5
      jdk 1.6

 

问题查出来是因为 struts.xml内action里的result的问题 只要它存在就报错 不存在就正常 以下是配置文件相应代码和信息

 

2010-4-9 13:55:12 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\chen\Environment\Java\jdk1.6.0_02\bin;D:\chen\Environment\Tomcat 5.5\bin
2010-4-9 13:55:13 org.apache.coyote.http11.Http11BaseProtocol init
信息: Initializing Coyote HTTP/1.1 on http-8081
2010-4-9 13:55:13 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 3047 ms
2010-4-9 13:55:13 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2010-4-9 13:55:13 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/5.5.25
2010-4-9 13:55:13 org.apache.catalina.core.StandardHost start
信息: XML validation disabled
log4j:WARN No appenders could be found for logger (org.apache.commons.digester.Digester.sax).
log4j:WARN Please initialize the log4j system properly.
2010-4-9 13:55:18 org.apache.catalina.core.StandardContext start
严重: Error filterStart
2010-4-9 13:55:18 org.apache.catalina.core.StandardContext start
严重: Context [/a] startup failed due to previous errors
2010-4-9 13:55:18 org.apache.catalina.core.ApplicationContext log
信息: org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
2010-4-9 13:55:19 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
2010-4-9 13:55:19 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
2010-4-9 13:55:19 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
2010-4-9 13:55:19 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
2010-4-9 13:55:19 org.apache.coyote.http11.Http11BaseProtocol start
信息: Starting Coyote HTTP/1.1 on http-8081
2010-4-9 13:55:19 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2010-4-9 13:55:19 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/62  config=null
2010-4-9 13:55:19 org.apache.catalina.storeconfig.StoreLoader load
信息: Find registry server-registry.xml at classpath resource
2010-4-9 13:55:19 org.apache.catalina.startup.Catalina start
信息: Server startup in 6703 ms

 

<?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="add" namespace="/" abstract="struts-default">
            <action name="addUser" class="com.chen.test.action.add.AddUserAction">
               <!--问题就是下面这个result它存在就报错 不存在就没问题-->
                   <result name="success">/index.jsp</result>
            </action>
          </package>
        </struts>

 

package com.chen.test.action.add;

import com.chen.test.dao.UserDAO;
import com.chen.test.dao.impl.UserDAOImpl;
import com.chen.test.pojo.User;
import com.opensymphony.xwork2.ActionSupport;


public class AddUserAction extends ActionSupport {

    private User user;
    private UserDAO userDAO=new UserDAOImpl();
    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }
    
    @Override
    public String execute() throws Exception {
        return SUCCESS;
    }
}

 

<?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">
    <filter>
       <filter-name>struts2</filter-name>
       <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
    </filter>
    <filter-mapping>
       <filter-name>struts2</filter-name>
       <url-pattern>/*</url-pattern>
    </filter-mapping>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
</web-app>

 

1个回答

[color=blue][b]是 extends 不是 abstract[/b][/color]
[code="xml"] [/code]

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问