我的web.xml文件(放在WEB-INF/里)
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
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_2_5.xsd">
<!-- struts2拦截器
<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>直接访问index.jsp首页可以访问得到..把文件里的<filter />和</filter-mapping />两个标签的注释去掉,
加上这个struts配置,再访问首页就出现404错误..
各位大虾帮帮忙..刚学struts2..
我的struts.xml文件(放在WEB-INF/classpath里)
<?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="struts" extends="struts-default">
<action name="login" class="com.struts2.action.LoginAction">
<result>/result.jsp</result>
</action>
</package>
</struts>
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
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_2_5.xsd">
<!-- struts2拦截器
<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>直接访问index.jsp首页可以访问得到..把文件里的<filter />和</filter-mapping />两个标签的注释去掉,
加上这个struts配置,再访问首页就出现404错误..
各位大虾帮帮忙..刚学struts2..
我的struts.xml文件(放在WEB-INF/classpath里)
<?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="struts" extends="struts-default">
<action name="login" class="com.struts2.action.LoginAction">
<result>/result.jsp</result>
</action>
</package>
</struts>
运行环境Tomcat6.0,JDK1.6,j2ee 5,
开发工具clipse3.2+myEclipse5.5在web.xml加上struts拦截器,访问首页出现404错误,去掉后访问首页正常..