2012-10-18 16:58:06 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:\myeclipse\bin;D:\tomcat 6.0\bin
2012-10-18 16:58:07 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2012-10-18 16:58:07 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 1309 ms
2012-10-18 16:58:07 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2012-10-18 16:58:07 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.35
2012-10-18 16:58:07 org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deploying configuration descriptor manager.xml
2012-10-18 16:58:08 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory docs
2012-10-18 16:58:08 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory JSPExample
2012-10-18 16:58:08 org.apache.catalina.loader.WebappClassLoader validateJarFile
信息: validateJarFile(D:\tomcat 6.0\webapps\JSPExample\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
2012-10-18 16:58:08 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory ROOT
2012-10-18 16:58:08 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory struts
2012-10-18 16:58:10 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Parsing configuration file [struts-default.xml]
2012-10-18 16:58:11 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Unable to locate configuration files of the name struts-plugin.xml, skipping
2012-10-18 16:58:11 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Parsing configuration file [struts-plugin.xml]
2012-10-18 16:58:11 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Unable to locate configuration files of the name struts.xml, skipping
2012-10-18 16:58:11 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Parsing configuration file [struts.xml]
2012-10-18 16:58:11 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.ObjectFactory)
2012-10-18 16:58:11 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.FileManager)
2012-10-18 16:58:11 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.impl.XWorkConverter)
2012-10-18 16:58:11 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.TextProvider)
2012-10-18 16:58:11 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.ActionProxyFactory)
2012-10-18 16:58:11 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.ObjectTypeDeterminer)
2012-10-18 16:58:11 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (org.apache.struts2.dispatcher.mapper.ActionMapper)
2012-10-18 16:58:11 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (jakarta) for (org.apache.struts2.dispatcher.multipart.MultiPartRequest)
2012-10-18 16:58:11 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (org.apache.struts2.views.freeer.FreeerManager)
2012-10-18 16:58:11 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (org.apache.struts2.components.UrlRenderer)
2012-10-18 16:58:11 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.validator.ActionValidatorManager)
2012-10-18 16:58:11 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.util.ValueStackFactory)
2012-10-18 16:58:11 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.util.reflection.ReflectionProvider)
2012-10-18 16:58:11 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.util.reflection.ReflectionContextFactory)
2012-10-18 16:58:11 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.util.PatternMatcher)
2012-10-18 16:58:11 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (org.apache.struts2.dispatcher.StaticContentLoader)
2012-10-18 16:58:11 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.UnknownHandlerManager)
2012-10-18 16:58:11 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (org.apache.struts2.views.util.UrlHelper)
2012-10-18 16:58:11 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2012-10-18 16:58:11 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2012-10-18 16:58:11 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/44  config=null
2012-10-18 16:58:12 org.apache.catalina.startup.Catalina start
信息: Server startup in 4710 ms
2012-10-18 17:04:02 org.apache.catalina.startup.HostConfig checkResources
信息: Reloading context [/struts]
2012-10-18 17:04:05 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Parsing configuration file [struts-default.xml]
2012-10-18 17:04:06 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Unable to locate configuration files of the name struts-plugin.xml, skipping
2012-10-18 17:04:06 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Parsing configuration file [struts-plugin.xml]
2012-10-18 17:04:06 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Unable to locate configuration files of the name struts.xml, skipping
2012-10-18 17:04:06 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Parsing configuration file [struts.xml]
2012-10-18 17:04:06 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.ObjectFactory)
2012-10-18 17:04:06 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.FileManager)
2012-10-18 17:04:06 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.impl.XWorkConverter)
2012-10-18 17:04:06 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.TextProvider)
2012-10-18 17:04:06 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.ActionProxyFactory)
2012-10-18 17:04:06 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.ObjectTypeDeterminer)
2012-10-18 17:04:06 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (struts) for (org.apache.struts2.dispatcher.mapper.ActionMapper)
2012-10-18 17:04:06 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Choosing bean (jakarta) for (org.apache.struts2.dispatcher.multipart.MultiPartRequest)
一下是WEB.XML

<?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>struts 2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts 2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping></web-app>以下是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="default" extends="struts-default">
<action name="upload" class="org.action.StructAction">
<result name="success">/welcome.jsp</result>
<result name="error">/hello.jsp</result>
</action>
</package>
</struts>刚开始学,各种错误,,都快崩溃了,拜托各位哥哥姐姐帮个忙,小妹在此谢过了

解决方案 »

  1.   

    我只能说,你贴出来的不是错误信息,只是tomcat在控制台输出的类似日志的信息。
    所以,还没看到有什么错
      

  2.   

    package org.action;
    import java.util.Map;
    import com.opensymphony.xwork2.ActionContext;
    import com.opensymphony.xwork2.ActionSupport;
    public class StructAction extends ActionSupport{
    private String name; public String getName() {
    return name;
    } public void setName(String name) {
    this.name = name;
    }
    public String execute()throws Exception
    {
    if(!name.equals("Hello World"))
    {
    Map request=(Map)ActionContext.getContext().get("request");
    request.put(name,getName());
    return "success";
    }
    else
    return "error";
    }
    }
      

  3.   

    <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
    <html>
    <head>
    <title>struts 2</title>
    </head>
    <body>
    <form action="Struts.action" method="post">
    请输入姓名:
    <input type="text" name="name" />
    <br>
    <input type="submit" value="提交" />
    </form> </body>
    </html><%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
    <%@taglib uri="/struts-tags" prefix="s" %><html>
      <head>   
        <title> struts 2.0</title>
      </head>
      
      <body>
    hello <s:property value="#request.name"/>!
      </body>
    </html>
      

  4.   

    你在Struts.xml中配置的Action是upload(Struts2用它匹配upload.action的URL请求)
    <action name="upload" class="org.action.StructAction">
    而你在表单中配置的请求是Struts.action,所以不匹配.
    <form action="Struts.action" method="post">
    改成
    <form action="upload.action" method="post">
    试一下.
      

  5.   

    request.put(name,getName()),这句话要改成request.put(“name”,getName())。
      

  6.   

    楼主现在这样使用struts个人觉得有点不妥哈,很乱,你可以在action中实现ModelDriven独立一个formbean出来
      

  7.   

    写程序的时候不要一口气写完,要边写边测试。我一开始也喜欢一口气写完,然后可能即使花十倍的精力和时间都找不到错在哪。
    第一步:确保你的welcome.jsp,hello.jsp能直接访问
    第二步:form表单提交能够执行StrutsAction
    然后就改吧
    只要改几个地方就行了:
    web.xml没问题
    struts.xml没问题
    StructAction:红色的两行删了(只需用name属性传输数据就行了,不需要用request)
    public String execute()throws Exception
    {
    if(!name.equals("Hello World"))
    {
    Map request=(Map)ActionContext.getContext().get("request");
    request.put(name,getName());

    return "success";
    }
    else
    return "error";
    }
    }welcome.jsp:红色的改成upload(因为你的struts.xml里设定的action名就是upload,写别的是访问不到StrutsAction的)
    <form action="Struts.action" method="post">
    请输入姓名:
    <input type="text" name="name" />
    <br>
    <input type="submit" value="提交" />
    </form>
    hello.jsp:红色的去掉就ok
    <body>
    hello <s:property value="#request.name"/>!
     </body>希望可以对你有所帮助
      

  8.   

    你的环境配置有问题,应该是你的web,structs的jar包不完整造成的。从网络上下载一个通过的安装指导文件,完全重新做一次,就可以了。