struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cedric Dumoulin <cedric.dumou...@lifl.fr>
Subject Re: iterate in a template
Date Mon, 27 Aug 2001 16:23:54 GMT

  I'm not sure this will solves your problem, but you should use at least REQUEST_SCOPE rather
than PAGE_SCOPE to
store your list. Page scope is only available in the current jsp page. If you use templates,
you include/insert
different pages, so you can't pass your list with PAGE_SCOPE.

  Hope this help,

    Cedric

Marion Schwarz wrote:

> Hello world,
>
> I'm trying to fill a struts template with an interate tag. The collection, an ArrayList,
is set in the jsp page.
> My Code looks like this:
>
> JSP-Page
> =========================================================
> ...
> <%
>               ArrayList testList = new ArrayList();
>               testList.add("test_1");
>               testList.add("test_2");
>               testList.add("test_3");
>
>               pageContext.setAttribute("testList", testList, PageContext.PAGE_SCOPE);
> %>
>               <template:insert template='template.jsp'>
>               <template:put ...
>                                                   including various template contents
>               </template:insert>
>
> ...
>
> Template- Page
> ===============================================================================
> <%@ taglib uri='/WEB-INF/struts-template.tld' prefix='template' %>
> <%@ taglib uri='/WEB-INF/struts-logic.tld' prefix='logic' %>
> <%@ taglib uri='/WEB-INF/struts-bean.tld' prefix='bean' %>
> <% Object testList = pageContext.getAttribute("testList", PageContext.PAGE_SCOPE );
 %>
>
> <table>
> ...
>           <template:get ...
>                          various template contents
>
> ...
>           <td width=125>
>             <logic:iterate id="myList" name="testList" >
>                 <p><bean:write name="myList" /><p>
>             </logic:iterate>
>          </td>
> </table>
> ============================================================================
>
> Unfortunatly I keep getting a  PageContextImpl.handlePageException.
> What am I doing wrong ??
>
> Marion


Mime
View raw message