myeclipse中的struts2问题
web.xml中的代码:<?xmlversion="1.0"encoding="UTF-8"?><web-appversion="3.0"xmlns="http://ja...
web.xml中的代码:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0"
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_3_0.xsd">
<display-name></display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<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>
</web-app>
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="com" extends="struts-default">
<action name="HelloReader" class="com.HelloReader">
<result>/helloreader.jsp</result>
</action>
</package>
</struts>
HelloReader中的代码:
package com;
import com.opensymphony.xwork2.ActionSupport;
public class HelloReader extends ActionSupport {
public static final String MESSAGE="Hello Reader! I'm from Struts2";
public String execute() throws Exception
{
setMessage(MESSAGE);
return SUCCESS;
}
private String message;
public void setMessage(String message)
{
this.message=message;
}
public String getMessage()
{
return message;
}
}
不知道哪个地方错啦,浏览的时候出现404错误,在配置struts.xml时候是自己在src下建立的,自己敲的代码, 不知道哪里错了,初学者,求救! 展开
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0"
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_3_0.xsd">
<display-name></display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<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>
</web-app>
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="com" extends="struts-default">
<action name="HelloReader" class="com.HelloReader">
<result>/helloreader.jsp</result>
</action>
</package>
</struts>
HelloReader中的代码:
package com;
import com.opensymphony.xwork2.ActionSupport;
public class HelloReader extends ActionSupport {
public static final String MESSAGE="Hello Reader! I'm from Struts2";
public String execute() throws Exception
{
setMessage(MESSAGE);
return SUCCESS;
}
private String message;
public void setMessage(String message)
{
this.message=message;
}
public String getMessage()
{
return message;
}
}
不知道哪个地方错啦,浏览的时候出现404错误,在配置struts.xml时候是自己在src下建立的,自己敲的代码, 不知道哪里错了,初学者,求救! 展开
1个回答
2013-08-09
展开全部
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
<init-param>
<param-name>actionPackages</param-name>
<param-value>org.strutsdemo.action</param-value>
</init-param>
</filter>
<filter>
<filter-name>struts-cleanup</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ActionContextCleanUp
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts-cleanup</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>fileUp.jsp</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
看有个com的包,咱访问的呢
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
<init-param>
<param-name>actionPackages</param-name>
<param-value>org.strutsdemo.action</param-value>
</init-param>
</filter>
<filter>
<filter-name>struts-cleanup</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ActionContextCleanUp
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts-cleanup</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>fileUp.jsp</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
看有个com的包,咱访问的呢
追问
什么意思呢?没看明白。。说具体些好吗,谢谢!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询