刚学习这个,在网上找了哈Struts2的配制方法,跟到做,配置好了访问就显示404错误...郁闷啊!哪位大大帮哈小弟~~~~
===================================================
web.xml的配置:<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" 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">
<display-name>ssh2</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
===================================================
struts.xml的配置(按网上说的放到src的根目录下):<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd"><struts>
<package name="default" namespace="/" extends="struts-default"> <action name="index" class="com.struts2.action.Test1Action" method="execute">
<result name="success">/test1.jsp</result>
</action>
</package>
</struts>
===================================================
我的Test1Action:
public class Test1Action extends ActionSupport{
public String execute() throws Exception{
System.out.println("----1----");
return SUCCESS;
}
}
===================================================
后台打印的“--------1—---------”都没打印,意思是连这个都没进....
访问地址用什么都不行.....
Help!!!~~~
===================================================
web.xml的配置:<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" 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">
<display-name>ssh2</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
===================================================
struts.xml的配置(按网上说的放到src的根目录下):<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd"><struts>
<package name="default" namespace="/" extends="struts-default"> <action name="index" class="com.struts2.action.Test1Action" method="execute">
<result name="success">/test1.jsp</result>
</action>
</package>
</struts>
===================================================
我的Test1Action:
public class Test1Action extends ActionSupport{
public String execute() throws Exception{
System.out.println("----1----");
return SUCCESS;
}
}
===================================================
后台打印的“--------1—---------”都没打印,意思是连这个都没进....
访问地址用什么都不行.....
Help!!!~~~
要使用namespace,就给它赋值嘛namespace=“/login” 8080/tomcat里你的工程名/login/index