how to pass 2 Domain obects to 1 jsp page via controller
guys i need your help,
please tell me how can i pass 2 different domain object in 1 jsp page via one spring controller.
and also tell how can i retrieve it,
let i have 开发者_开发知识库2 class having atleast 2 fields
i think i have to use a MAP(key,value)
but how can i use it in jsp
how can i call the different object that are stored in the values ok map.
please guide me friends
thanks
You just put your two objects under different keys in your Model
/ ModelAndView
/ Map
/ ..:
@RequestMapping(..)
public String controllerMethod(..., Model model) {
model.addAttribute("object1", foo);
model.addAttribute("object2", bar);
}
in the JSP:
${object1.something}
${object2.anotherThing}
精彩评论