struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Hardy <adam_ha...@altavista.com>
Subject Re: Quick question about iterators & beans on a page
Date Fri, 15 Feb 2002 16:38:21 GMT
Sorry, I missed the point with the forwarding completely. I can change the action mapping in
my struts-config to go to the new action instead of the jsp, right? 




On Fri, 15 February 2002, geert@bossuyt.com wrote:

> 
> You probably could do that but I'm pretty sure it will not be fast developping.
> Also I think it is not the right way to do struts.
> 
> Just do what you have to do in a simple java action and throw your stuff on the 
> request or the session ( if the data needs to live longer then one request  ) .
> Then in your jsp simply use the struts tags to display the data that is on the 
> request.
> 
> Keep it simple !  
> Keep your knowledge and action in your java actions,
> let struts manage the flow through struts-config.xml 
> and use your jsp's to simply display the information that you have retrieved in 
> your actions !
> 
> greet,
> Geert.
> 
> On 15 Feb 2002 07:55:15 -0800 Adam Hardy <adam_hardy@altavista.com> wrote:
> >Yowsa! Someone is listening. I've just got a bit of P, which doesn't make it 
> easier.
> I did actually get that far in the thought process, but several Actions can 
> forward to this
> page, so can't I just do the stuff in a bean & a tag? 
> >
> >How about ditching the seperate bean & subclassing the iterator and calling up

> my data in the
> doStart? That means I don't have to pass in the request to the constructor 
> because I've got
> the TagSupport methods. Or does this conflict with MVC in a big way? I mean 
> I've got my data
> access class which just returns a rowset, all nice & seperate.
> >
> >
> >
> >
> >On Fri, 15 February 2002, geert@bossuyt.com wrote:
> >
> >> 
> >> 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>


Mime
View raw message