1. 程式人生 > >ssh整合之struts.xml

ssh整合之struts.xml

開啟struts2.core核心包,找到struts-2.3.dtd

複製一段宣告就可以了

<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"

"http://struts.apache.org/dtds/struts-2.3.dtd">

例子:

<?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>
<constant name="struts.objectFactory" value="spring"></constant>
<!-- 訪問的話要namespace+name配合訪問這個action -->
<package name="crm" namespace="/" extends="struts-default">
<action name="UserAction_*" class="cn.itcast.web.action.UserAction" method="{1}">
<result name="success">/success.jsp</result>
</action>
</package>

</struts>

其中constan是整合spring把Action物件建立交給spring