最近項目需要在JS中跳轉到指定的Action。通過不斷的實驗和查資料,終于成功。Java SSH2 架構下,正常 配置Action完畢。在xxx.jsp下
window.location=" ";
例如:window.location=" /user/ResAction> ";
其中ResAction是配置文件中的Action名稱。
通過以上就可實現了跳轉到指定的Action。
但是讓我比較納悶的一點問題是:
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
我已經在Jsp頁面上寫了以上的URL代碼,為什么在window.location=" 還是需要再寫一遍呢?希望知道的朋友給我留言。先謝謝了。