Showing results for 
Search instead for 
Did you mean: 

problem in iterating a collection object put inside model.addAllattibutes in jsp page

Former Member
0 Kudos

Hi experts,

In DeliveryMethodCheckoutStepController

 final List<AbstractOrderEntryModel> ent = cartModel.getEntries();

I have tried to iterate AbstractOrderEntryModel list in chosedeliverymethodPage.jsp by fetching ProductModel attributes , as

 <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
 <%@ page trimDirectiveWhitespaces="true"%>
 <%@ taglib prefix="template" tagdir="/WEB-INF/tags/responsive/template"%>
 <%@ taglib prefix="cms" uri=""%>
 <%@ taglib prefix="spring" uri=""%>
 <%@ taglib prefix="multi-checkout" tagdir="/WEB-INF/tags/responsive/checkout/multi"%>
 <%@ taglib prefix="ycommerce" uri="" %>
 <%@ page import="java.util.List"%>
 <%@taglib prefix="c" uri="" %>
 <spring:htmlEscape defaultHtmlEscape="true" />
 <%List eList = (List)session.getAttribute("ent");
    request.setAttribute("eList", eList);
 <template:page pageTitle="${pageTitle}" hideHeaderLinks="true">
  <c:forEach items="${eList}" var="entry">
             <td>Product: <c:out value="${entry.getProduct().getBoughtimes()}"/></td>
             <td>Bought: <c:out value="${entry.getProduct()}"/></td>  

But am getting an error saying scripting elements disallowed,

Is there a way out to iterate them..Plz help
Thanks in advance

View Entire Topic
Former Member
0 Kudos

Hi ,

Update the code like this in your java class:

 model.addAttribute("eList", ent);

And remove the script code from your jsp i.e.

   <%List eList = (List)session.getAttribute("ent");
     request.setAttribute("eList", eList);

Former Member
0 Kudos

That worked brilliantly...Thanks Sourav.. :)