在我的Spring MVC項目中,我創建了一個註冊頁面。在這個頁面中有一個用戶插入他的信息(名字,姓氏等)的表單。我已經使用了Spring標籤形式將對象「客戶」綁定到表單。在我的控制,我有:春季:註冊表從模型中刪除對象
@RequestMapping(value="/registration",method=RequestMethod.GET)
public String viewRegistration(ModelMap model){
model.addAttribute("cliente",clienteFactory.createCliente());
return "registrazione";
}//registrazione
在registration.jsp
<form:form method="post" action="add" modelAttribute="cliente">
....
</form:form>
在這個項目中我沒有使用Spring Security的,因爲我是一個學生,我還沒有學會這部分呢。 如果用戶離開網頁時沒有登記,我要刪除的對象「Cliente」從model.How我能解決這個問題?謝謝
如果我更改爲「發佈」,我有:HTTP狀態405 - 請求方法'GET'不支持 – Alex 2014-12-03 12:29:36
當然!最佳做法有2種方法將一個映射爲get和post映射一個。 http://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html#mvc-ann-requestmapping – njjnex 2014-12-03 12:46:00
因爲在jsp中我打電話給'Registration' – Alex 2014-12-03 12:52:46