You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Brian McSweeney <br...@aurium.net> on 2003/04/14 14:26:04 UTC

When to populate drop downs

Hi all,

anyone have an opinion about when to populate drop-down menus if the data is 
dynamic? Currently I've a wizard with 3 steps/actions. In the middle of the wizard 
I populate some drop down lists by putting their contents in the form object. 
Is this a bad idea? Two reasons have me slightly concerned at this:

1) because it's a wizard, the form object is stored in session scope - this will 
mean that all the options in the drop down lists are stored in session scope.

2) If somehow the user gets to the jsp without going through the steps of the 
wizard, then they won't have any options in the drop down lists.

Does this seem reasonable? In general do people populate drop down lists on 
the jsp itself?  They are dynamic lists by the way - localized.

thanks,
Brian

Re: When to populate drop downs

Posted by Brian McSweeney <br...@aurium.net>.
Perhaps you are right Tib,
I had planned on having a switch your language button on the
bottom of the pages, but maybe it's just simpler to do as you
say and keep the countries in english. Thanks for your help,
Brian

----- Original Message -----
From: "Gemes Tibor" <ti...@i-trade.hu>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Monday, April 14, 2003 2:02 PM
Subject: Re: When to populate drop downs


> Brian McSweeney írta:
>
> >Is this a better way to do it do you think?
> >
> >
> The doc says that if the bean is not specified it uses the formbean, so
> it is a right and supported way imho.
>
> >Also, people must surely have had the need to display countries in
> >a drop down list. This is a standard web-app feature. Have people tried
> >to internationalize these? I know that the Locale.getIsoCountries( )
method
> >
> >
>   not sure it is appropriate to internationalise the countries.
>
> Once a friend of mine changed the locale of my cellphone.
> It was a nightmare to choose the right language from the list of
> languages localized to a language unknown.
>
> Try to change your google locale eg to haxor, and switch back without
> the button "google in english".
>
> Tib
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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


Re: When to populate drop downs

Posted by Gemes Tibor <ti...@i-trade.hu>.
Brian McSweeney írta:

>Is this a better way to do it do you think?
>  
>
The doc says that if the bean is not specified it uses the formbean, so 
it is a right and supported way imho.

>Also, people must surely have had the need to display countries in
>a drop down list. This is a standard web-app feature. Have people tried
>to internationalize these? I know that the Locale.getIsoCountries( ) method
>  
>
  not sure it is appropriate to internationalise the countries.

Once a friend of mine changed the locale of my cellphone.
It was a nightmare to choose the right language from the list of  
languages localized to a language unknown.

Try to change your google locale eg to haxor, and switch back without 
the button "google in english".

Tib




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


Re: When to populate drop downs

Posted by Brian McSweeney <br...@aurium.net>.
Is this a better way to do it do you think?

Also, people must surely have had the need to display countries in
a drop down list. This is a standard web-app feature. Have people tried
to internationalize these? I know that the Locale.getIsoCountries( ) method
returns a list of countries. Each of these can also give a display name in a
different language. Do people generally use this list or a subset of it or
their
own list.
thanks,
Brian



----- Original Message -----
From: "Gemes Tibor" <ti...@i-trade.hu>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Monday, April 14, 2003 1:33 PM
Subject: Re: When to populate drop downs


> Brian McSweeney írta:
>
> >Does this seem reasonable? In general do people populate drop down lists
on
> >the jsp itself?  They are dynamic lists by the way - localized.
> >
> >
> I do, however localizaton happens on the jsp in my case.
>
> Tib
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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


Re: When to populate drop downs

Posted by Brian McSweeney <br...@aurium.net>.
ah! I'm learning, slowly but surely :-)
thanks!
Brian


----- Original Message -----
From: "Gemes Tibor" <ti...@i-trade.hu>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Monday, April 14, 2003 2:52 PM
Subject: Re: When to populate drop downs


> Brian McSweeney írta:
>
> >sorry,
> >I have missunderstood. What happens if someone goes to
> >your jsp without running the action beforehand? You will
> >get empty drop down lists, no?
> >
> >
> In struts you try to hide your jsps as much as possible. Eg. by putting
> it under
> WEB-INF to avoid direct access to it. So normally the user has no chance
> going to it directly.
>
> Tib
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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


Re: When to populate drop downs

Posted by Gemes Tibor <ti...@i-trade.hu>.
Brian McSweeney írta:

>sorry,
>I have missunderstood. What happens if someone goes to
>your jsp without running the action beforehand? You will
>get empty drop down lists, no?
>  
>
In struts you try to hide your jsps as much as possible. Eg. by putting 
it under
WEB-INF to avoid direct access to it. So normally the user has no chance
going to it directly.

Tib



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


select list

Posted by Florian Convers <fc...@webnet.fr>.
Hi,

Is there someone who can tell me why :

with in class : mybeanpackage.MyBeanClass
2 getters :  Vector getIds() and Vector getLabels()

This works :
<jsp:useBean id="mySessionBean" scope="session"
class="mybeanpackage.MyBeanClass" />
<html:text name="mySessionBean" property="ids" />
<html:text name="mySessionBean" property="labels" />

So I can see the vectors in the html text fields

And this doesn't works :
<jsp:useBean id="mySessionBean" scope="session"
class="mybeanpackage.MyBeanClass" />
<html:select property="idSelected">
    <html:options name="mySessionBean" property="ids"
labelProperty="labels"/>
</html:select>

Thanks
Florian





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


Re: When to populate drop downs

Posted by Brian McSweeney <br...@aurium.net>.
:-)
maybe my problems aren't so bad after all.
I haven't seen any dolphins yet at least.
thanks for the help and advice,
Brian


----- Original Message -----
From: "Andrew Hill" <an...@gridnode.com>
To: "Struts" <st...@jakarta.apache.org>
Sent: Monday, April 14, 2003 3:13 PM
Subject: RE: When to populate drop downs


> 1. Im not much of a JSP expert myself (Im using DOM API & xhtml for my
view
> rendering) but basically you just shove all the JSPs down under web-inf ,
> and make sure everything goes through an action first. The action then
> forwards to the JSP (you would confgure the path as a forward in
> struts-config). There should be lots of examples around if you look. Im
sure
> Ive seen examples of this in all 3 of the struts books Ive looked at (pjs,
> sia, sk)
>
> 2. Well this depends on how you implement it. If you can reconstruct the
> drop downs each time this may be a better option - however when doing
> wizards its often very hard to avoid making use of the session for various
> things - like the actionForm being filled in. Hidden fields can only go so
> far - and sometimes you need to store stuff in the session.
>
> The app Im working on uses the session like a fish uses water(*), but its
> (mostly) for intranet use, has rather complex ui requirements and is not
> expecting millions of simultaneuos users. For a public website like amazon
> on the other hand this would be a bad idea - but obviously you have to
> sacrifice some of the more complex and stateful ui designs if you dont
make
> use of the session...
>
> (*) To extend the analogy a little past breaking point - my app also makes
a
> dolphin perfoming acrobatic tricks look clumsy when you see the sort of
> hoops it has to jump through to get all that junk out of the session once
> its no longer needed...
>
> -----Original Message-----
> From: Brian McSweeney [mailto:brian.mcsweeney@aurium.net]
> Sent: Monday, 14 April 2003 21:53
> To: Struts Users Mailing List; andrew.david.hill@gridnode.com
> Subject: Re: When to populate drop downs
>
>
> Hi andrew,
> thanks for the reply. Two things
>
> 1) is there an example of how to do this, if it is standard best practise.
>
> 2) if you are in a wizard, the drop down contents are going to be in
> a form that is in session scope. Is this not putting alot in the session
> object - is this not a problem?
>
> Brian
>
>
> ----- Original Message -----
> From: "Andrew Hill" <an...@gridnode.com>
> To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> Sent: Monday, April 14, 2003 2:44 PM
> Subject: RE: When to populate drop downs
>
>
> > Thats why its generally considered a best poactice to put your jsps
under
> > web-inf, or assign some kind of security such that they can only be
> reached
> > by a server-side forward (from an action) and not directly
> >
> > -----Original Message-----
> > From: Brian McSweeney [mailto:brian.mcsweeney@aurium.net]
> > Sent: Monday, 14 April 2003 21:31
> > To: Struts Users Mailing List
> > Subject: Re: When to populate drop downs
> >
> >
> > sorry,
> > I have missunderstood. What happens if someone goes to
> > your jsp without running the action beforehand? You will
> > get empty drop down lists, no?
> >
> > I was saying is it not better to populate the dropdown list
> > in the jsp itself? This is what I thought you were recommending.
> >
> > Brian
> >
> > PS - my last question was stupid - I realise now that you could
> > just put the code in a scriptlet.
> >
> >
> > ----- Original Message -----
> > From: "Gemes Tibor" <ti...@i-trade.hu>
> > To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> > Sent: Monday, April 14, 2003 2:17 PM
> > Subject: Re: When to populate drop downs
> >
> >
> > > Brian McSweeney írta:
> > >
> > > >Also Tib,
> > > >do you do this in a static block on the jsp, or is there some sort of
> > > >onLoad method that you do this in.
> > > >
> > > >
> > > I load the  list in the form prepopulate action.
> > >
> > > Tib
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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


RE: When to populate drop downs

Posted by Andrew Hill <an...@gridnode.com>.
1. Im not much of a JSP expert myself (Im using DOM API & xhtml for my view
rendering) but basically you just shove all the JSPs down under web-inf ,
and make sure everything goes through an action first. The action then
forwards to the JSP (you would confgure the path as a forward in
struts-config). There should be lots of examples around if you look. Im sure
Ive seen examples of this in all 3 of the struts books Ive looked at (pjs,
sia, sk)

2. Well this depends on how you implement it. If you can reconstruct the
drop downs each time this may be a better option - however when doing
wizards its often very hard to avoid making use of the session for various
things - like the actionForm being filled in. Hidden fields can only go so
far - and sometimes you need to store stuff in the session.

The app Im working on uses the session like a fish uses water(*), but its
(mostly) for intranet use, has rather complex ui requirements and is not
expecting millions of simultaneuos users. For a public website like amazon
on the other hand this would be a bad idea - but obviously you have to
sacrifice some of the more complex and stateful ui designs if you dont make
use of the session...

(*) To extend the analogy a little past breaking point - my app also makes a
dolphin perfoming acrobatic tricks look clumsy when you see the sort of
hoops it has to jump through to get all that junk out of the session once
its no longer needed...

-----Original Message-----
From: Brian McSweeney [mailto:brian.mcsweeney@aurium.net]
Sent: Monday, 14 April 2003 21:53
To: Struts Users Mailing List; andrew.david.hill@gridnode.com
Subject: Re: When to populate drop downs


Hi andrew,
thanks for the reply. Two things

1) is there an example of how to do this, if it is standard best practise.

2) if you are in a wizard, the drop down contents are going to be in
a form that is in session scope. Is this not putting alot in the session
object - is this not a problem?

Brian


----- Original Message -----
From: "Andrew Hill" <an...@gridnode.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Monday, April 14, 2003 2:44 PM
Subject: RE: When to populate drop downs


> Thats why its generally considered a best poactice to put your jsps under
> web-inf, or assign some kind of security such that they can only be
reached
> by a server-side forward (from an action) and not directly
>
> -----Original Message-----
> From: Brian McSweeney [mailto:brian.mcsweeney@aurium.net]
> Sent: Monday, 14 April 2003 21:31
> To: Struts Users Mailing List
> Subject: Re: When to populate drop downs
>
>
> sorry,
> I have missunderstood. What happens if someone goes to
> your jsp without running the action beforehand? You will
> get empty drop down lists, no?
>
> I was saying is it not better to populate the dropdown list
> in the jsp itself? This is what I thought you were recommending.
>
> Brian
>
> PS - my last question was stupid - I realise now that you could
> just put the code in a scriptlet.
>
>
> ----- Original Message -----
> From: "Gemes Tibor" <ti...@i-trade.hu>
> To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> Sent: Monday, April 14, 2003 2:17 PM
> Subject: Re: When to populate drop downs
>
>
> > Brian McSweeney írta:
> >
> > >Also Tib,
> > >do you do this in a static block on the jsp, or is there some sort of
> > >onLoad method that you do this in.
> > >
> > >
> > I load the  list in the form prepopulate action.
> >
> > Tib
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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


Re: When to populate drop downs

Posted by Brian McSweeney <br...@aurium.net>.
Hi andrew,
thanks for the reply. Two things

1) is there an example of how to do this, if it is standard best practise.

2) if you are in a wizard, the drop down contents are going to be in
a form that is in session scope. Is this not putting alot in the session
object - is this not a problem?

Brian


----- Original Message -----
From: "Andrew Hill" <an...@gridnode.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Monday, April 14, 2003 2:44 PM
Subject: RE: When to populate drop downs


> Thats why its generally considered a best poactice to put your jsps under
> web-inf, or assign some kind of security such that they can only be
reached
> by a server-side forward (from an action) and not directly
>
> -----Original Message-----
> From: Brian McSweeney [mailto:brian.mcsweeney@aurium.net]
> Sent: Monday, 14 April 2003 21:31
> To: Struts Users Mailing List
> Subject: Re: When to populate drop downs
>
>
> sorry,
> I have missunderstood. What happens if someone goes to
> your jsp without running the action beforehand? You will
> get empty drop down lists, no?
>
> I was saying is it not better to populate the dropdown list
> in the jsp itself? This is what I thought you were recommending.
>
> Brian
>
> PS - my last question was stupid - I realise now that you could
> just put the code in a scriptlet.
>
>
> ----- Original Message -----
> From: "Gemes Tibor" <ti...@i-trade.hu>
> To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> Sent: Monday, April 14, 2003 2:17 PM
> Subject: Re: When to populate drop downs
>
>
> > Brian McSweeney írta:
> >
> > >Also Tib,
> > >do you do this in a static block on the jsp, or is there some sort of
> > >onLoad method that you do this in.
> > >
> > >
> > I load the  list in the form prepopulate action.
> >
> > Tib
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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


RE: When to populate drop downs

Posted by Andrew Hill <an...@gridnode.com>.
Thats why its generally considered a best poactice to put your jsps under
web-inf, or assign some kind of security such that they can only be reached
by a server-side forward (from an action) and not directly

-----Original Message-----
From: Brian McSweeney [mailto:brian.mcsweeney@aurium.net]
Sent: Monday, 14 April 2003 21:31
To: Struts Users Mailing List
Subject: Re: When to populate drop downs


sorry,
I have missunderstood. What happens if someone goes to
your jsp without running the action beforehand? You will
get empty drop down lists, no?

I was saying is it not better to populate the dropdown list
in the jsp itself? This is what I thought you were recommending.

Brian

PS - my last question was stupid - I realise now that you could
just put the code in a scriptlet.


----- Original Message -----
From: "Gemes Tibor" <ti...@i-trade.hu>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Monday, April 14, 2003 2:17 PM
Subject: Re: When to populate drop downs


> Brian McSweeney írta:
>
> >Also Tib,
> >do you do this in a static block on the jsp, or is there some sort of
> >onLoad method that you do this in.
> >
> >
> I load the  list in the form prepopulate action.
>
> Tib
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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


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


Re: When to populate drop downs

Posted by Brian McSweeney <br...@aurium.net>.
sorry,
I have missunderstood. What happens if someone goes to
your jsp without running the action beforehand? You will
get empty drop down lists, no?

I was saying is it not better to populate the dropdown list
in the jsp itself? This is what I thought you were recommending.

Brian

PS - my last question was stupid - I realise now that you could
just put the code in a scriptlet.


----- Original Message -----
From: "Gemes Tibor" <ti...@i-trade.hu>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Monday, April 14, 2003 2:17 PM
Subject: Re: When to populate drop downs


> Brian McSweeney írta:
>
> >Also Tib,
> >do you do this in a static block on the jsp, or is there some sort of
> >onLoad method that you do this in.
> >
> >
> I load the  list in the form prepopulate action.
>
> Tib
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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


Re: When to populate drop downs

Posted by Gemes Tibor <ti...@i-trade.hu>.
Brian McSweeney írta:

>Also Tib,
>do you do this in a static block on the jsp, or is there some sort of
>onLoad method that you do this in.
>  
>
I load the  list in the form prepopulate action.

Tib




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


Re: When to populate drop downs

Posted by Brian McSweeney <br...@aurium.net>.
Also Tib,
do you do this in a static block on the jsp, or is there some sort of
onLoad method that you do this in.
thanks,
Brian

----- Original Message -----
From: "Gemes Tibor" <ti...@i-trade.hu>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Monday, April 14, 2003 1:33 PM
Subject: Re: When to populate drop downs


> Brian McSweeney írta:
>
> >Does this seem reasonable? In general do people populate drop down lists
on
> >the jsp itself?  They are dynamic lists by the way - localized.
> >
> >
> I do, however localizaton happens on the jsp in my case.
>
> Tib
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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


Re: When to populate drop downs

Posted by Gemes Tibor <ti...@i-trade.hu>.
Brian McSweeney írta:

>Does this seem reasonable? In general do people populate drop down lists on 
>the jsp itself?  They are dynamic lists by the way - localized.
>  
>
I do, however localizaton happens on the jsp in my case.

Tib




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