读书人

struts2拦截器参数传递有关问题

发布时间: 2012-09-08 10:48:07 作者: rapoo

struts2拦截器参数传递问题
配置struts2拦截器拦截action时,如果请求url中含有参数,会出现参数丢失的问题。例如:
http://localhost:8080/recommend/portal/appInfo.action?itemId=1007300000053536
参数itemId在请求的action中可能会接收不到。


解决方案:
<action name="appInfo" method="showAppInfo">
<interceptor-ref name="myInterceptor"></interceptor-ref>
<interceptor-ref name="defaultStack"></interceptor-ref>
<result name="success">/WEB-INF/jsp/AppInfo.jsp</result>
</action>
不配置红色部分,会造成请求参数丢失错误,切记!!!

读书人网 >软件架构设计

热点推荐