I have a method returns an ArrayList which display products. I had created a controller
final String inputFileName = "Onto.owl";
String categorie = "Mode";
String nom = "HasName";
String description= "HasDescription";
@RequestMapping(method = RequestMethod.GET)
public ModelAndView handleRequest(HttpServletRequest arg0,
HttpServletResponse arg1) throws Exception {
ModelAndView modelAndView = new ModelAndView("index");
modelAndView.addObject("pList", GetAllFonction.displayProducts(inputFileName, categorie));
return modelAndView;
}
then I iterate using c:foreach
on the the ArrayList(pList)
<c:forEach var="value" items="${pList}">
<tr>
<td> <c:out value="${value}"/></td>
</tr>
</c:forEach>
but the table is empty.
please check GetAllFonction.displayProducts(inputFileName, categorie)
method is returning any values or it is empty.
OR
instead of this line
modelAndView.addObject("pList", GetAllFonction.displayProducts(inputFileName, categorie));
You can add below code to cross check it
List<String> **list**=new ArrayList<String>();
list.add("vishal");
list.add("biradar");
modelAndView.addObject("pList",**list**);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.