0
嗨,我試圖改變在彈簧控制器中的表單動作時,瀏覽器中點擊不同的網址。在彈簧控制器中動態地更改表單動作名稱
當我點擊網址:http://localhost:8080/DEMO/shas/getExtLogin?key=11然後,action以action =「/ DEMO/shas/getExtLogin?key = 11」的形式添加到表單標籤中。
,但我需要改變行動,行動= 「/ DEMO /管理/」 在LoginController.java getExternalLogin()方法,擊中時網址:http://localhost:8080/DEMO/shas/getExtLogin?key=11
我的JSP代碼:login.jsp的
<form:form id="login" commandName="loginDO" clas="form-header">
我的Java代碼:LoginController.java
@RequestMapping(value = "/getExtLogin", method = RequestMethod.GET)
public ModelAndView getExternalLogin(HttpServletRequest request) {
String extInd = request.getParameter("extInd");
request.getSession().setAttribute("extInd", extInd);
return new ModelAndView("jsp/login").addObject("loginDO", new LoginDO());
}
有沒有辦法來改變春季控制器形式的行動,而返回的ModelAndView?
的[春季增加一個管理部分]可能的複製(https://stackoverflow.com/questions/15302699/adding-an-admin-section-in-spring) –
我需要在Java文件中設置而不是xml中的配置。 – DEADEND