0

Hello everybody. I have a ModelAndView object:

@RequestMapping(value="/stage")
public ModelAndView stage(HttpServletRequest request, HttpServletResponse response) throws IOException 
{
    ...
    ModelAndView model = new ModelAndView();
    model.addObject("option","a");
    model.setViewName("product/stage");
    return model;
}

I can access from Jquery a view "product/stage" using the functions load or ajax, but, how to access the object "option" from Jquery? Thanks for your help.

  • You don't. Java servlets are server side. Javascript is client side. You won't be accessing an _object_. – Sotirios Delimanolis Nov 04 '14 at 16:46
  • I guess a more appropriate question would be "why would you want to do this?". You can get the data to jQuery after putting it into the model but it'd be cumbersome. You'd have to grab the server side data on your jsp page (or other view technology) and parse it into a jQuery object. – M7Jacks Nov 04 '14 at 17:04

0 Answers0