Done it!!
Here's my solution:
I used thymeleaf so I can render a page in my controller.
I use some parts of different info I found on the web.. Not remembet them all, so thanks and sorry to not put the link here....
First I send the form data via ajax to the controller. In the controller I create an object and set the status field to SUCCESS of FAIL, if fail i return set the error info on my object, if success I set a field to the html of my page response. So I send this object back to the client (JSON) and analise the fields.
Bellow is the code:
The controller:
@RequestMapping(value = "/calcdireto.json", method = RequestMethod.POST)
public @ResponseBody CalcDiretoResponse processFormAjaxJson(Model model,
@ModelAttribute(value = "formBean") @Valid CalcDiretoFormBean cdBean,
BindingResult result) {
CalcDiretoResponse res = new CalcDiretoResponse();
if (!result.hasErrors()) {
res.setValStatus("SUCCESS");
final WebContext ctx = new WebContext(request,servletContext,request.getLocale());
res.setHtml(this.templateEngine.process("subpage", ctx));
return res;
} ...
And in the page:
if (response.valStatus == 'SUCCESS') {
$("#pp-result").html(response.htm);
}
Thats all!