struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <George.Dinwid...@wellsfargo.com>
Subject RE: struts logic:iterate ---- c:forEach of JSTL
Date Tue, 03 Jan 2006 20:47:22 GMT
Have you tried using <c:out> instead of <bean:write>?

> -----Original Message-----
> From: fea jabi [mailto:zyxrm@hotmail.com] 
> Sent: Tuesday, January 03, 2006 11:37 AM
> To: user@struts.apache.org
> Subject: struts logic:iterate ---- c:forEach of JSTL
> 
> 
> In struts config file I have it as
> 
> <form-bean name="Form1" type=".........DynaValidatorForm "> 
> ....................... <form-property name="Items" 
> type="java.util.ArrayList"/> <form-property 
> name="selectedItems" type="java.lang.String[]"/> </form-bean>
> 
>      <action
>         path="/PrepareHrsAction"
>         type="PrepareHrsAction"
>         name="Form1"
>         scope="session"
>         validate="false"
>         input="/Hrs.jsp">
>         <forward name="success" path="/Hrs.jsp" redirect="false"/>
>      </action>
> 
> 
> 
> In prepare action have the below which creates this list
> 
> private ArrayList getItems(DynaValidatorForm form1) { 
> LabelValueBean lblValueBean1 = new LabelValueBean("Visa1", 
> "V1"); LabelValueBean lblValueBean2 = new 
> LabelValueBean("MasterCard1", "M1"); LabelValueBean 
> lblValueBean3 = new LabelValueBean("American Exp", "AE1");
> 
> 
> //Options
> ArrayList itemsList = new ArrayList();
> itemsList .add(lblValueBean1);
> itemsList .add(lblValueBean2);
> itemsList .add(lblValueBean3);
> 
> ............................
> ..............................
> 
> String[] selectedList = {lblValueBean3.getValue(),
> lblValueBean1.getValue()
> };
> 
> form1.set("Items", itemsList);
> form1.set("SelectedItems", selectedList);
> 
> return itemsList;
> }
> 
> In jsp
> <table>
>   <c:forEach var="item" items="${Form1.Items}">
>     <tr>
>       <td>
>         <html:multibox name="Form1" property="selectedItems">
>          <bean:write name="item" property="value"/>
>         </html:multibox>
>         <bean:write name="item" property="label"/>
>       </td>
>     </tr>
>   </c:forEach>
> </table>
> 
> 
> 
> It works fine with the <logic:iterate> tag. Only when trying 
> to use JSTL 
> <c:forEach> the jsp doesn't get displayed correctly.
> 
> Any idea why is that?
> 
> Thanks.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message