struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@bossuyt.com
Subject Re: Quick question about iterators & beans on a page
Date Fri, 15 Feb 2002 15:19:58 GMT
In the action that will be forwarded to your jsp you put a list(e.g. an 
ArrayList)  on the request.  This list contains bean of some kind.
Then in your jsp you can write : 

<logic:iterate id="item" name="NameOfMyListOnTheRequest" scope="request">
   <bean:write name="item" 
property="SomePropertyOfTheBeansThatAreInTheListOnTheRequest" />
</logic:iterate>

On 15 Feb 2002 07:01:59 -0800 Adam Hardy <adam_hardy@altavista.com> wrote:
>Being a bit slow off the mark with this iterator tag. I've found all sorts of 
examples and
some stuff in the archives here but it's confused me more than helped me. 
>
>If I want a list displayed, no form, just data, the best place to get it is in 
a page context
bean, right? 
>
>Second, how do I access the page context or the session from within that bean? 
>
>I take it I don't want to create my own bespoke iterator tag, right?
>
>Any help gratefully received. 
><logic:falling fast>Adam</logic>
>
>
>
>On Fri, 15 February 2002, Adam Hardy wrote:
>
>> 
>> Hi All,
>> 
>> I want to populate a table with data from a database, so presumably I create 
a bean on a
jsp which calls the database, and converts it and hands it to an iterator. 
>> 
>> First, how do I make the data thread-safe? Is it thread-safe because it is 
in a jsp which
is therefore compiled into a local variable in its corresponding servlet?
>> 
>> Second, how do I get the user's ID in the bean? Do I pass it in to the bean 
constructor as
a parameter via the usebean tag, or do I pass in the session, or can I get the 
session somehow
in the bean (from getPageContext or similar)?
>
>
>Find the best deals on the web at AltaVista Shopping!
>http://www.shopping.altavista.com
>
>--
>To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>
>
>


-- 
Get your firstname@lastname email at http://Nameplanet.com/?su

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


Mime
View raw message