Help retrieving data from a controller with Spring?

0

I have the following method that returns a list, from which I want to retrieve a field and if you bring it to me, I use the model to send the value of that field to the jsp, but it does not show anything in the browser console

@ResponseBody
@RequestMapping(value= "/obtenerLista", method=(RequestMethod.POST, RequestMethod.GET), consumes= MediaType.APPLICATION_JSON_VALUE)
public JsonResponseGeneric<TipoCliente> llenaLista(@RequestBody JsonResponse datosJson,  Model model){

    ObjectMapper object = new ObjectMapper();
    ClaseDTO parametro = object.readValue(datosJason.getJson(), ClaseDTO.class);
    
     JsonResponseGeneric<TipoCliente> listaCliente = new JsonResponseGeneric<TipoCliente>();
     
     List<TipoCliente> llenaLista = srvicio.consultaLista(parametro.getServicio());
     model.addAttribute("valorTipo", llenaLista.get(0).getIdTipoServicio());
     listaCliente.setLista(llenaLista);
     
    return listaCliente;
}

and in my jsp I recover it in a hidden input

<input type="hidden" id="inputTipo" name="inputTipo"  value="${llenaLista.get(0).getIdTipoServicio()}"



console.log("id" +$("#inputTipo").val());

How can I recover this information and send it to my jsp? I hope you can support me

    
asked by Root93 14.09.2018 в 06:17
source

0 answers