[color=red]具体为一下几个步骤:
1、引入Struts 2工程所需运行jar包。
2、创建并配置web.xml文件,添加filter标签
3、创建并配置struts.xml文件。[/color]
引入Struts 2工程所需运行jar包
把以下几个运行库文件复制到工程的WEB-INF下的lib文件夹中。
[img]http://dl.iteye.com/upload/attachment/0071/2186/5fb33ebf-03cf-3622-9368-e01382ba5512.jpg[/img]
创建并配置web.xml文件,添加filter标签,在web.xml中配置FilterDispatcher
<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>
创建并配置struts.xml文件
<?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">
<constant name="struts.devMode" value="true" />
<package name="default" namespace="/" extends="struts-default">
<action name="hello">
<result>/hello.jsp</result>
</action>
</package>
</struts>
1、引入Struts 2工程所需运行jar包。
2、创建并配置web.xml文件,添加filter标签
3、创建并配置struts.xml文件。[/color]
引入Struts 2工程所需运行jar包
把以下几个运行库文件复制到工程的WEB-INF下的lib文件夹中。
[img]http://dl.iteye.com/upload/attachment/0071/2186/5fb33ebf-03cf-3622-9368-e01382ba5512.jpg[/img]
创建并配置web.xml文件,添加filter标签,在web.xml中配置FilterDispatcher
<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>
创建并配置struts.xml文件
<?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">
<constant name="struts.devMode" value="true" />
<package name="default" namespace="/" extends="struts-default">
<action name="hello">
<result>/hello.jsp</result>
</action>
</package>
</struts>