使用DynaActionForm 可以不用form这个类,通过配置,在action中直接取得。
1 Action中--------
DynaActionForm newsForm = (DynaActionForm) form;
News news = (News) newsForm.get("news");
。。。。。。。。。
newsForm.set("news", news);
2:配置----------
<form-bean name="newsForm" type="org.apache.struts.action.DynaActionForm">
<form-property name="news" type="com.***.it.tcps.persist.News" />
</form-bean>
<action
path="/news/newsClass"
type="com.***.it.tcps.news.action.NewsClassAction"
parameter="method"
unknown="false"
validate="true"
>
<forward
name="view"
path="/WEB-INF/jsp/news/leftNewsClassView.jsp"
redirect="false"
/>
</action>
1 Action中--------
DynaActionForm newsForm = (DynaActionForm) form;
News news = (News) newsForm.get("news");
。。。。。。。。。
newsForm.set("news", news);
2:配置----------
<form-bean name="newsForm" type="org.apache.struts.action.DynaActionForm">
<form-property name="news" type="com.***.it.tcps.persist.News" />
</form-bean>
<action
path="/news/newsClass"
type="com.***.it.tcps.news.action.NewsClassAction"
parameter="method"
unknown="false"
validate="true"
>
<forward
name="view"
path="/WEB-INF/jsp/news/leftNewsClassView.jsp"
redirect="false"
/>
</action>