0
在我的Spring應用程序,當我在我的形式提交按鈕點擊重新加載頁面,我敢肯定,我已經忘記了什麼東西,但我不能看到錯誤提交按鈕不提交
在JSP ,我創建這樣的形式:
<form:form commandName="municipioBean" method="POST">
<label for="df_mun">Estado</label>
<form:select path="df_edo" name="df_edo" id="df_edo"
onchange="getMunicipios();">
<form:option value="0">Seleccione un estado...</form:option>
<form:options items="${listaEstado}" itemValue="codProvincia"
itemLabel="desProvincia" />
</form:select>
<label for="df_mun">Municipio</label>
<form:select path="df_mun" name="df_mun" id="df_mun">
<option selected value="0">Seleccione un estado primero...</option>
</form:select>
<form:hidden id="id_ciudadano" path="id_ciudadano" />
<input type="submit" name="procesar" value="Aceptar" />
</form:form>
而且我的控制器:
@RequestMapping(method = RequestMethod.POST, params = "procesar")
public String procesaSubmit(
@ModelAttribute("municipioBean") MunicipioBean municipioBean,
BindingResult result, HttpServletRequest request, ModelMap model) {
return ConstantesAbre.PASOS_JSP;
}
PARAMS值等於我的名字提交按鈕,它的確定太RequestMethod,有什麼問題呢? 。
感謝的建議和我的英語不好對不起d:
我不得不爲每個路徑的方法,因爲我需要不同的路徑在我的控制器,這樣的事情: \t @RequestMapping( 「/ municipio.htm」) \t公共字符串的init(ModelMap模型,HttpServletRequest的請求, \t \t \t HttpServletResponse響應){ \t \t return url; \t} 在我的app-servlet中,我有一個標籤。 –
嘗試添加一個System.out.println語句來查看該方法是否實際上被調用。如果它可能是沒有顯示在屏幕上的綁定錯誤。 – blong824
ViewResolver是問題和RequestMapping中的「值」-_- 感謝您的幫助! –