I've some problem with this simple server side method (java/hibernate):
@RequestMapping(value="/Prova" , method=RequestMethod.POST)
@Transactional( propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public ResponseEntity<String> Prova(
HttpServletRequest request, HttpServletResponse response
) throws Exception
{
log.error("Sono qui");
return new ResponseEntity<String>("pippotopolinopaperino",HttpStatus.OK);
}
If the client does an AJAX request (I use ExtJs) the response is:
pippotopolinopa0015↵
WHY?
P.s sorry for my bad english
P.p.s I've tried also with:
@RequestMapping(value="/Prova" , method=RequestMethod.POST)
@Transactional( propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public @ResponseBody String Prova(
HttpServletRequest request, HttpServletResponse response
) throws Exception
{
log.error("Sono qui");
return "pippotopolinopaperino";
}
I've solved in this way:
@RequestMapping(value="/Prova" , method=RequestMethod.POST)
@Transactional( propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public @ResponseBody List<String> Prova(
HttpServletRequest request, HttpServletResponse response
) throws Exception
{
log.error("Sono qui");
List<String> ret = new ArrayList<String>();
ret.add("pippoPlutoTopolino");
return ret;
}
Or also:
@RequestMapping(value="/Prova2" , method=RequestMethod.POST)
@ResponseBody public StringBuffer Prova2(
HttpServletRequest request
) throws Exception
{
return new StringBuffer("pippoPlutoTopolino");
}
But I don't understand why doesn't work returning a simple String.