1
我正在將應用程序從struts1遷移到struts2。我在這裏有一個用例。在調用操作後,在動作url中添加查詢參數
public String execute() throws Exception {
..... some code here.....
ActionForward inputForward = HttpRedirector.getRedirectToInput(request,
mapping, "id=" + request.getParameter("id") + "&" +
request.getQueryString(), filterForm);
return inputForward;
}
當它重定向到輸入頁面的URL
被修改爲::?Struts1的行動在URL這樣增加了查詢字符串
http://localhost:8084/struts2App/board.jspID = 1個&空
同樣地,我有在我的struts2動作url中添加查詢字符串。目前我struts2的動作URL看起來是這樣的,當我提交表單:
本地主機:8084/struts2App/board.action
我想修改它,用同樣的方式在struts1中做過這樣的:
http://localhost:8084/struts2App/board.action?ID = 1 &空
這裏是struts2的操作映射
<action name="board*" class="com.nextjet.web.hud.BoardAction">
<result name="success">/board.jsp</result>
<result name="input">/board.jsp</result>
</action>
有人可以告訴我如何實現它。
http://struts.apache.org/docs/redirect-action-result.html。 –
@AleksandrM OP還沒有分配任何變量名傳遞'request.getQueryString()',在這種情況下,添加''標記是不可能的。 –
@VinothKrishnan什麼? –