You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by GiT <gt...@columbus.rr.com> on 2000/10/21 16:12:54 UTC

Support for ComboBox

Hi All,

I am a new to this list.
Is there an archive available for this list that can be searched ?


I have a requirement wherein I need to populate a ComboBox from a
Database.Wanted to know if struts has any kind of support available in
order to achieve the same.

Thanks.
Gigen

Re: Support for ComboBox

Posted by GiT <gt...@columbus.rr.com>.
Hi Pierre,

Thanks a lot.I am going through the docs to look at the usage of the 
select  and option  tags.


Once again thanks  a lot for that quick response!!!



Pierre Métras wrote:
> 
> Hi Gigen
> 
> > Is there an archive available for this list that can be searched ?
> >
> http://archive.covalent.net
> 
> > I have a requirement wherein I need to populate a ComboBox from a
> > Database.Wanted to know if struts has any kind of support available in
> > order to achieve the same.
> 
> Right from the box, no.
> You'll have to write a bean that reads your data from the database and put
> it in two arrays (one for values, other for labels) or collections. Then,
> you can use the <struts:select> and <struts:options> tags to create the
> combobox and populate the option from the arrays.
> The main idea of struts is to separate presentation (your combobox) from the
> data, so the need for an intermediate bean (the controller) to manage them.
> 
> Pierre Métras

Re: Support for ComboBox

Posted by Thierry Cools <th...@s1.com>.
It depends of how persistent are the data you want to put in you Combo., e.g. if you have to fill in a combo with countries, this will not change during your application so you could put it in the session or even in the application scope, but for data that have to change a lot it's maybe a good idea to put them in the request scope and so to fill the data in the ActionForm

Thierry Cools
 
Senior Java Developer 
S1 Brussels 
Kleine Kloosterstraat, 23 
1932 st. Stevens-Woluwe 
Belgium 
Tel : +32 2 200 43 82 
Email : thierry.cools@s1.com 

  ----- Original Message ----- 
  From: GThomas 
  To: struts-user@jakarta.apache.org 
  Sent: Tuesday, October 24, 2000 5:39 AM
  Subject: Re: Support for ComboBox



  Again on the ComboBox, How should the arrays be passed to the jsp page.

  I can think of a couple of ways to do it.
  1. Could be passed through the session object.

  2. Could be instantiated as part of the ActionForm.

  Could someone please throw some light on this.


  Thanks.

  Pierre Métras wrote:

  > 
  > Hi Gigen
  > 
  > > Is there an archive available for this list that can be searched ?
  > >
  > http://archive.covalent.net
  > 
  > > I have a requirement wherein I need to populate a ComboBox from a
  > > Database.Wanted to know if struts has any kind of support available in
  > > order to achieve the same.
  > 
  > Right from the box, no.
  > You'll have to write a bean that reads your data from the database and put
  > it in two arrays (one for values, other for labels) or collections. Then,
  > you can use the <struts:select> and <struts:options> tags to create the
  > combobox and populate the option from the arrays.
  > The main idea of struts is to separate presentation (your combobox) from the
  > data, so the need for an intermediate bean (the controller) to manage them.
  > 
  > Pierre Métras


Re: Support for ComboBox

Posted by GThomas <gt...@columbus.rr.com>.
Again on the ComboBox, How should the arrays be passed to the jsp page.

I can think of a couple of ways to do it.
1. Could be passed through the session object.

2. Could be instantiated as part of the ActionForm.

Could someone please throw some light on this.


Thanks.

Pierre Métras wrote:

> 
> Hi Gigen
> 
> > Is there an archive available for this list that can be searched ?
> >
> http://archive.covalent.net
> 
> > I have a requirement wherein I need to populate a ComboBox from a
> > Database.Wanted to know if struts has any kind of support available in
> > order to achieve the same.
> 
> Right from the box, no.
> You'll have to write a bean that reads your data from the database and put
> it in two arrays (one for values, other for labels) or collections. Then,
> you can use the <struts:select> and <struts:options> tags to create the
> combobox and populate the option from the arrays.
> The main idea of struts is to separate presentation (your combobox) from the
> data, so the need for an intermediate bean (the controller) to manage them.
> 
> Pierre Métras

Re: Support for ComboBox

Posted by Pierre Métras <ge...@sympatico.ca>.
Hi Gigen

> Is there an archive available for this list that can be searched ?
>
http://archive.covalent.net


> I have a requirement wherein I need to populate a ComboBox from a
> Database.Wanted to know if struts has any kind of support available in
> order to achieve the same.

Right from the box, no.
You'll have to write a bean that reads your data from the database and put
it in two arrays (one for values, other for labels) or collections. Then,
you can use the <struts:select> and <struts:options> tags to create the
combobox and populate the option from the arrays.
The main idea of struts is to separate presentation (your combobox) from the
data, so the need for an intermediate bean (the controller) to manage them.

Pierre Métras