I have to return values from two modelandview methods to a single jsp `mySoftwarelist.jsp` where i have two tables. Here i have two seperate methods for returning array list
ModelAndView getLegacySuiteList()
ModelAndView getSuiteList()
i returned the arraylist `mySoftwareList`,`mySoftwareLegacyList` to the same view `swl_mySoftwareList` as
public ModelAndView getSuiteList(HttpServletRequest request, HttpServletResponse response) throws Exception
{
ArrayList mySoftwareList = new ArrayList();
try{
MySoftwareListHelper mySoftwareListHelper = new MySoftwareListHelper();
userEmailAddr =user.getEmailaddress();
mySoftwareList = mySoftwareListHelper.getSuites(userEmailAddr);
}
catch(Exception e) {
e.printStackTrace();
}
ModelAndView mnv = new ModelAndView("swl_mySoftwareList","mySoftwareList",mySoftwareList);
return mnv;
}
public ModelAndView getLegacySuiteList(HttpServletRequest request, HttpServletResponse response) throws Exception
{
ArrayList mySoftwareLegacyList = new ArrayList();
try{
MySoftwareListHelper mySoftwareListHelper = new MySoftwareListHelper();
userEmailAddr =user.getEmailaddress();
mySoftwareLegacyList = mySoftwareListHelper.getLegacySuites(userEmailAddr);
}catch(Exception e){
e.printStackTrace();
}
ModelAndView mnv = new ModelAndView(“swl_mySoftwareList”,”mySoftwareLegacyList”,mySoftwareLegacyList);
return mnv;
}
but its returning only the model mySoftwareList.
I want data from both the arraylist to be used on same jsp.
You need to add both the list separately in the same mnv object before you return to the view.
Hope this helps.
Cheers.