cancel
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();
     model.addAllAttributes(ent);

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="http://hybris.com/tld/cmstags"%>
 <%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
 <%@ taglib prefix="multi-checkout" tagdir="/WEB-INF/tags/responsive/checkout/multi"%>
 <%@ taglib prefix="ycommerce" uri="http://hybris.com/tld/ycommercetags" %>
 <%@ page import="java.util.List"%>
 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <!DOCTYPE HTML>
 
 <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">
         <tr>
             <td>Product: <c:out value="${entry.getProduct().getBoughtimes()}"/></td>
             <td>Bought: <c:out value="${entry.getProduct()}"/></td>  
         </tr>
     </c:forEach>
 </div>


But am getting an error saying scripting elements disallowed,

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

Accepted Solutions (1)

Accepted Solutions (1)

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.. :)

Answers (0)