1、struts 2.5.2
基本jar包
2、web.xml
<!-- Filters -->
<!-- START SNIPPET: filter -->
<filter>
<filter-name>struts252</filter-name>
<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<!-- END SNIPPET: filter -->
<filter-mapping>
<filter-name>struts252</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter struts>=2.5使用
3、struts.xml
在source floder下
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">
<struts>
<package name="myPackage" extends="struts-default">
<action name="first">
<result>/first.jsp</result>
</action>
</package>
</struts>
热部署, 开发时,可打开开发模式。
<constant name="struts.devMode" value="true" />
4、JSP
5、测试
访问http://localhost:8080/struts2/first或http://localhost:8080/struts2/first.action