views:

37

answers:

1

If I have a modelandView like:

ModelAndView mav = new ModelAndView();

mav.setViewName("index");
mav.addObject("message", "hello, world");

return mav;

In index.jsp, how do I output the value of "message"?

And what if I passed in:

mav.addObject("user", currentUser);

It seems the docs jump straight into forms handling.

+4  A: 

You can output it by using the EL language like this:

${message} and ${user}

In your jsp. Spring with automatically scan the jsp and process these and other EL expressions.

Derek Clarkson