struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark <markl...@libero.it>
Subject Re: OptionsCollection
Date Fri, 13 Dec 2002 11:01:23 GMT
I've read the documentation.. The confusion is how do i access a collection
when the action returns another

Imagine i've a user form and a list of users on the same page.

[list returned via request via action]
Joe Bloggs
Another User
Etc

Add user form
Name <input box>
Company <select menu>

I've already passed a list of users via the request object, and I'm not
happy with the concept of having to run an action everytime i want to get a
collection.

I could have a bunch of collections in my session but I'd prefer to use the
request. I know how to do this by instantiating a bean in my jsp, but I
can't do this due to some silly design constraints because this might
involve people having to learn something else.

I can think of a few ways of attempting this but I imagine that there must
be a way of doing this only defining collections once and being able to list
without calling an action. Ideally my collections will be availble on any
page, without having to instantiate anything.

So far I can only see that manipulating forms via FormBean . But then what
happens when i want the collection for something else? I could be confused
but when i read the struts docs i got the impression that this sort of thing
was possible. 

Many thanks mark
 

On 13-12-2002 11:44, "VEDRE, RANAPRATAP REDDY" <VEDRE@engr.sc.edu> wrote:

> You can either use attribute collection="users" for options tag if you store
> in request
> or you can use               name="formName" property="myList"   if you have
> a getMyList() method for the form(You have to fill call formName.setMyList()
> in your action class before forwarding to a jsp).
> 
> 
> checkout http://jakarta.apache.org/struts/userGuide/struts-html.html#options
> if you have not looked at the documentation.
> 
> -rana.
> 
> 
> -----Original Message-----
> From: Mark [mailto:marklowe@libero.it]
> Sent: Friday, December 13, 2002 5:36 AM
> To: Struts Users Mailing List
> Subject: OptionsCollection
> 
> 
> Hello
> 
> I've a number of collections already defined that end up being passed to my
> jsp's via the request object.
> 
> Users in this case is a map defined in my business logic class that does db
> queries.
> 
> users = (ListUsers).getUsers();
> 
> request.setAttribute("users",users);
> 
> 
> I itertate through this collection using iterate. But now i want to use this
> in a select menu.
> 
> Should I be thinking about making my collection available to my FormBean i.e
> making a getMyList() method.
> 
> Thanks in advance
> 
> mark
> 
> 
> --
> To unsubscribe, e-mail:
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>
> 
> 


--
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