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>刚开始学,各种错误,,都快崩溃了,拜托各位哥哥姐姐帮个忙,小妹在此谢过了
信息: 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>刚开始学,各种错误,,都快崩溃了,拜托各位哥哥姐姐帮个忙,小妹在此谢过了
所以,还没看到有什么错
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";
}
}
<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>
<action name="upload" class="org.action.StructAction">
而你在表单中配置的请求是Struts.action,所以不匹配.
<form action="Struts.action" method="post">
改成
<form action="upload.action" method="post">
试一下.
第一步:确保你的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>希望可以对你有所帮助