views:

11

answers:

1

Hi,

I am using spring with appfuse framework and I would like to display two or three tables in my JSP page. Something like below,

<display:table name="users" cellspacing="0" cellpadding="0" requestURI="" id="names" class="table" export="true">.....</display:table>

....

in controller :

return new ModelAndView(getSuccessView(), Constants.PROFILE, fetchData());

But as you the controller can return only one collection of objects, I have to use two different underlying objects for different tables.

Confused on how to go about this?

Cheers, J

A: 

You really need to read the documentation for ModelAndView. Although the controller can only return a single ModelAndView, the model may contain many attributes.

ModelAndView mav = new ModelAndView(getSuccessView());
mav.addObject(Constants.PROFILE, fetchData());
mav.addObject(Constants.SOMETHINGELSE, fetchOtherData());
return mav;

See http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/web/servlet/ModelAndView.html

ptomli