I have a JSP page and I want to work just on the main content of the page, so when I click on some item of menu, it refreshes the main content of the page.
My main page:
<a onclick="formAjax()">Cartes objet de recours</a>
<div id="page_gestion"></div>
My ajax call:
function formAjax() {
$.ajax({
url : 'form1',
success : function(responce) {
$('#page_gestion').html(responce);
}
});
}
My controller:
@RequestMapping(value="/form1")
public String form1(Map<String, Object> model, HttpServletRequest request,
HttpServletResponse responce, ModelMap modelmap) {
model.put("lostcard", new Lostcard());
return "form/form1" ;
}
My JSP page, if we can say so, that loads the main content of the main page:
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<form:form method="POST" modelAttribute="lostcard" action="enregistrerLostCard"
id="formCard_Lost">
[...]
</form:form>
At this point everything is ok, but when I submit my form I get this error:
java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'lostcard' available as request attribute