Working with object in javascript

0

Well I'm trying to understand how to work with an object that comes from my controller in javascript, I've already done some tests to make sure this information went up correctly for the view, but I did not understand how to work with this information in javascript if someone can help, I'll be grateful.

Follow the controller I use to upload the object list

  @RequestMapping(value = "/show/{id}", method = RequestMethod.GET)
    public ModelAndView viewPesquisar(@PathVariable("id") Long id, ModelMap 
    model, HttpServletRequest request) {

    LOGGER.debug(" O id a ser consultado é {}", id);

    List<Ito> optional = itoService.findByIdFetchAll(id);

    if (optional.isEmpty()) {

        LOGGER.debug(" Não foi possivel localizar o Tipo com o Id:{}", id);

        throw new BusinessException("Não foi possivel Localizar o Tipo de Projeto");
    }

    List<Ito> listaCompletaItos = itoService.findByIdFetchAll(id);

    model.addAttribute("listaCompletaItos", listaCompletaItos);

    return new ModelAndView(REQUEST_MAPPING_PAGE_SHOW_ITO);
}

I send information to the view through ModelAndview, I do not know if it's the best way to do that.

    
asked by anonymous 20.07.2017 / 21:26

1 answer

0

You have two ways to do this! One is writing this information in the header of your page as a JavaScript variable and the other is pulling via JavaScript ajax to your controler! Only after you decide which one will you use and can I help you?

    
20.07.2017 / 23:29