Posted on 2011-08-09 10:23
疯狂 阅读(3228)
评论(0) 编辑 收藏 所属分类:
struts
1.
ognl 静态方法处理
<s:property value="@com.e104.rd.util.DynaEnvConstants@getInt('ROWS_PER_PAGE')"/>
struts2.0.1 支持
struts2.2.3 默认不支持,需要修改struts.xml
<constant name="struts.ognl.allowStaticMethodAccess" value="true" />
2. 参数传递的问题
var url = '../Search/ResumeSearchAction_loadResumeList.action?pageNo=<s:property value="pageNo"/> ';
var param = {
target : url,
method : 'post',
form: "searchConditionForm",
div: "resume_list_div"
}
<form id="searchConditionForm" name="searchConditionForm" method="post" action="">
<input type="hidden" name="pageNo" id="pageNo" value="1">
。。。。。。。。。
</form>
url 后面跟pageNo 参数,form里有pageNo 参数,
struts2.0.1 支持,struts2.2.3 不支持,需要把url后参数删除,且struts2.2.3 参数传递要比前版严格 ,
所以要测试,遇到参数传递的问题时候,再修改。
3.导入actions.xml;
struts2.0.1: <include file="**\actions.xml"/>
struts2.2.3:
<include file="/**/actions.xml"/>
4.默认拦截器的名字修改:
struts2.0.1:<interceptor-ref name="token-session">
struts2.2.3:<interceptor-ref name="tokenSession">
5.
struts2.0.1
<result name="LOGOUT" type="redirect-action">
struts2.2.3:
<result name="LOGOUT" type="redirectAction">
遇到拦截器名字,result type名字不一致,可以去查看
struts2-core-2.2.3.jar/struts-default.xml
6.
<pao:FilterSelect id="jobExp.disTime_origin" name="jobExp.disTime_t" source="DataCode_4" filter="0" locale="#session['test.locale']" headerKey="0" headerValue=" 请选择 "/>
更新成绿色部分
<pao:FilterSelect id="jobExp.disTime_origin" name="jobExp.disTime_t" source="DataCode_4" filter="{0}" locale="#session['test.locale']" headerKey="0" headerValue=" 请选择 "/>
7.
然后就是 json
com.googlecode.jsonplugin.JSONUtil 需要替换 org.apache.struts2.json.JSONUtil
其他可参考官网
https://cwiki.apache.org/S2WIKI/troubleshooting-guide-migrating-from-struts-20x-to-21x.html#TroubleshootingguidemigratingfromStruts2.0.xto2.1.x-UpdateDependencies
转自:http://accpchf.iteye.com/blog/1128492