Re: Quick question about iterators beans on a page

2002-02-17 Thread Adam Hardy
On Sat, 16 February 2002, Ted Husted wrote: The container gives each request its own thread. If the list is created with new in the action, and then placed into the request, it is thread-safe. Just the same as if you had created it on the JSP. So the request object that I can store

Re: Quick question about iterators beans on a page

2002-02-17 Thread Ted Husted
The request, session, and application context objects are part of the servlet specification. http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/ServletRequest.html http://java.sun.com/docs/books/tutorial/servlets/overview/architecture.html The Struts controller is not creating

Re: Quick question about iterators beans on a page

2002-02-16 Thread Adam Hardy
On Fri, 15 February 2002, [EMAIL PROTECTED] wrote: Adam, I've just cracked this myself. In your Action, set your collection to a session attribute: Vector someVec = valueBean.getSomeData(); session.setAttribute(itData, someVec); Then in your JSP: logic:iterate name=itData id=list

Re: Quick question about iterators beans on a page

2002-02-16 Thread Mark Woon
Adam Hardy wrote: (1) if you put it in the request, then it will get cleaned up by the server at the end of the page automatically, but in the session it will stay until the session dies, right? Yup. But you can also clean it out of the session yourself. (2) is it thread-safe? Guess it

Re: Quick question about iterators beans on a page

2002-02-16 Thread Ted Husted
The container gives each request its own thread. If the list is created with new in the action, and then placed into the request, it is thread-safe. Just the same as if you had created it on the JSP. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Java Web Development with Struts. -- Tel

Re: Quick question about iterators beans on a page

2002-02-16 Thread Mark Woon
Adam Hardy wrote: On Sat, 16 February 2002, Mark Woon wrote: (2) is it thread-safe? Guess it must be, but why? Does it all stay in one thread of the main struts controller servlet, and out of reach of any other threads? Depends on what you mean. If it's a read-only collection, then

Quick question about iterators beans on a page

2002-02-15 Thread Adam Hardy
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

Re: Quick question about iterators beans on a page

2002-02-15 Thread Adam Hardy
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

Re: Quick question about iterators beans on a page

2002-02-15 Thread geert
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

Re: Quick question about iterators beans on a page

2002-02-15 Thread Adam Hardy
Yowsa! Someone is listening. I've just got a bit of pressure on, 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

Re: Quick question about iterators beans on a page

2002-02-15 Thread geert
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 ) .

Re: Quick question about iterators beans on a page

2002-02-15 Thread Adam Hardy
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, [EMAIL PROTECTED] wrote: You probably could do that but I'm pretty sure it will not be fast

Re: Quick question about iterators beans on a page

2002-02-15 Thread jamesblakey
Adam, I've just cracked this myself. In your Action, set your collection to a session attribute: Vector someVec = valueBean.getSomeData(); session.setAttribute(itData, someVec); Then in your JSP: logic:iterate name=itData id=list scope=session ... /logic:iterate Hope this helps, James.