`
fspwp
  • 浏览: 48822 次
  • 性别: Icon_minigender_1
  • 来自: 佛山
社区版块
存档分类
最新评论

struts2 配置

阅读更多

struts2版本:2.1.8.1

 

1.拷贝jar

  1. commons-fileupload-X.X.X.jar
  2. commons-io-X.X.X.jar
  3. commons-logging-X.X.X.jar
  4. commons-logging-api.X.X.jar
  5. freemarker-X.X.X.jar
  6. ognl-X.X.X.jar
  7. struts2-core-X.X.X.X.jar
  8. xwork-core-X.X.X.jar

2.在web.xml中配置filter

<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>


3.在src中新增struts.xml

<?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>


	<constant name="struts.devMode"
 value="true"
 />


	<package name="basicstruts2"
 extends="struts-default"
>


		<action name="index"
>

			<result>
/index.jsp</result>

		</action>


	</package>


</struts>

4finish~!

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics