@RequestMapping( value = "getCliente.htm", method = RequestMethod.POST, produces = "Application/json") @ResponseBody public ClienteBean getCliente(@RequestParam("codigo") String codigo) { ClienteBean bean = clienteService.getCliente(codigo); if (bean == null) { bean = new ClienteBean(); bean.setCodigo("-1"); } return bean; }
@RequestMapping(value = "insCliente.htm", method = RequestMethod.POST) public String insCliente(@ModelAttribute ClienteBean clienteBean, Model model) { try { clienteService.insertar(clienteBean); model.addAttribute("mensaje", "Todo ok. Codigo: " + clienteBean.getCodigo()); } catch (Exception e) { model.addAttribute("mensaje", e.getMessage()); } return "insCliente"; }