Struts2:在Struts2拦截器中重写URL [英] Struts2 :Re-write URL in Struts2 interceptor
本文介绍了Struts2:在Struts2拦截器中重写URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在执行动作(即在拦截器中)后向URL附加参数.
I want to append a parameter to the URL after the execution of an action i.e in interceptor.
我该怎么做?
Struts.xml在这里
Here,Struts.xml
<action name="reviewpolist" class="purchaseOrderAction" method="getReviewPOList">
<result name="success">reviewpolist.jsp </result>
</action>
我当前的网址是-
localhost":8080/FLO_OSIII/po/jsp/reviewpolist.action?s=185366951
现在我想将参数GetFlg=1
添加到URl中,
now i want to add parameter GetFlg=1
to URl like,
localhost:8080/FLO_OSIII/po/jsp/reviewpolist.action?s=185366951&GetFlg=1
执行动作后. 动作-
public String getreviewpolist()throws Throwable{
// here my processing code.
return SUCCESS;
}
推荐答案
要在url中添加参数,您应该使用 UrlHelper
允许您以编程方式进行操作.例如
To add parameter in the url you should build the URL using s:url
tag or use UrlHelper
that allows you to do it programmatically. For example
<s:url action="reviewpolist" includeParams="get">
<s:param name="GetFlg" value="%{'1'}" />
</s:url>
这篇关于Struts2:在Struts2拦截器中重写URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文