You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Kavitha Ranga <ka...@wcom.com> on 2002/10/09 02:34:10 UTC

Pre-popluating the select dropdown.

I have a select dropdown in my JSP page.I retrieve the 
data from the database and depending on the value I get back I have 
to make that option as selected in my select dropdown.So the selected 
option cannot be hardcoded.It has to be dynamic. I could not see any of 
the select attributes which can accomplish this.
Has anyone tried to do this on the jsp using Struts ?

Thanks for any help.

Kavitha

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Pre-popluating the select dropdown.

Posted by Eddie Bush <ek...@swbell.net>.
Kavitha,

The first link shows a good example of using <html:select/> with nested 
<html:option/> elements.  It also give a reference to the example 
application so you can see it working in a "live demo".

Your form bean would have a property (the one being talked about in the 
mail) that indicates which value should be selected.  So - Struts does 
that for you :-) ... and you just have it be sure you set it right.  The 
list of options are easily obtained by just iterating over a collection 
and printing out the option tags (as is shown in the mail I linked to). 
 Look at the example to see a "working demo".

Hope that helps.

>| -----Original Message-----
>| From: Kavitha Ranga [mailto:kavitha.ranganathan@wcom.com]
>| Sent: Tuesday, October 08, 2002 7:50 PM
>| To: 'Struts Users Mailing List'
>| Subject: RE: Pre-popluating the select dropdown.
>| 
>| I did not see any which solves my problem.I have also gone through the
>| sample jsp which comes with Struts. Since my selected option is not
>going
>| to
>| be the same all the time,I cannot set the value .It has to be
>dyanamic.I
>| have seen many people ask the same question but so far I have not seen
>any
>| answer.
>| 
>| Kavitha
>
-- 
Eddie Bush




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Pre-popluating the select dropdown.

Posted by Jacob Hookom <ho...@uwec.edu>.
Try value="device.deviceType"

| -----Original Message-----
| From: Kavitha Ranga [mailto:kavitha.ranganathan@wcom.com]
| Sent: Tuesday, October 08, 2002 8:12 PM
| To: 'Struts Users Mailing List'
| Subject: RE: Pre-popluating the select dropdown.
| 
| Am I missing something?Let me try to explain what I am trying to
| accomplish.I have a jsp page with a dropdown .I have a list of option
and
| only one of the option from that list has to be displayed as selected
.The
| selected option is not the same all the time.It depends on what gets
| pulled
| from the database.So how do i set the specific option as "selected"
| dynamically each time? I did not see any "selected" attribute with
either
| the <html:select> or the <html:option>.
| 
| I tried something like this in my jsp.
| <html:select name="device" property="deviceID" value='<bean:write
| name="device" property="deviceType">'>
| <html:option value="1">one</html:option>
| <html:option value="2">two</html:option>
| </html:select>
| 
| But the value attribute does not work.
| 
| Any help is highly appreciated.
| Kavitha
| 
| -----Original Message-----
| From: Jacob Hookom [mailto:hookomjj@uwec.edu]
| Sent: Tuesday, October 08, 2002 8:59 PM
| To: 'Struts Users Mailing List'
| Subject: RE: Pre-popluating the select dropdown.
| 
| 
| That's because they usually end in "RTFM"
| 
| http://jakarta.apache.org/struts/doc-1.0.2/struts-html.html#options
| 
| 
| | -----Original Message-----
| | From: Kavitha Ranga [mailto:kavitha.ranganathan@wcom.com]
| | Sent: Tuesday, October 08, 2002 7:50 PM
| | To: 'Struts Users Mailing List'
| | Subject: RE: Pre-popluating the select dropdown.
| |
| | I did not see any which solves my problem.I have also gone through
the
| | sample jsp which comes with Struts. Since my selected option is not
| going
| | to
| | be the same all the time,I cannot set the value .It has to be
| dyanamic.I
| | have seen many people ask the same question but so far I have not
seen
| any
| | answer.
| |
| | Kavitha
| |
| | -----Original Message-----
| | From: Eddie Bush [mailto:ekbush@swbell.net]
| | Sent: Tuesday, October 08, 2002 8:46 PM
| | To: Struts Users Mailing List
| | Subject: Re: Pre-popluating the select dropdown.
| |
| |
| | Kavitha Ranga wrote:
| |
| | >I have a select dropdown in my JSP page.I retrieve the
| | >data from the database and depending on the value I get back I have
| | >to make that option as selected in my select dropdown.So the
selected
| | >option cannot be hardcoded.It has to be dynamic. I could not see
any
| of
| | >the select attributes which can accomplish this.
| | >Has anyone tried to do this on the jsp using Struts ?
| | >
| | Yes.  At least 3 people in the last two days have asked this
question.
| |  It's a popular one.  Did you try searching the archive?  Google?
Oh
| | ... here's a fair one, I think:
| |
| |
|
http://www.mail-archive.com/struts-user@jakarta.apache.org/msg44110.html
| |
| | There are others:
| |
| | http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-
| | 8&q=Struts+Default+Option
| |
| | Google does wonderous magic with the mail archive.  I have no clue
how
| | it finds such relevant posts, but it does a beautiful job of doing
so.
| |
| | Hope that helps.
| |
| | --
| | Eddie Bush
| |
| |
| |
| |
| | --
| | To unsubscribe, e-mail:
| | <ma...@jakarta.apache.org>
| | For additional commands, e-mail:
| | <ma...@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:
| <ma...@jakarta.apache.org>
| For additional commands, e-mail:
| <ma...@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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Pre-popluating the select dropdown.

Posted by Kavitha Ranga <ka...@wcom.com>.
Am I missing something?Let me try to explain what I am trying to
accomplish.I have a jsp page with a dropdown .I have a list of option  and
only one of the option from that list has to be displayed as selected .The
selected option is not the same all the time.It depends on what gets pulled
from the database.So how do i set the specific option as "selected"
dynamically each time? I did not see any "selected" attribute with either
the <html:select> or the <html:option>.

I tried something like this in my jsp.
<html:select name="device" property="deviceID" value='<bean:write
name="device" property="deviceType">'>
<html:option value="1">one</html:option>
<html:option value="2">two</html:option>
</html:select>

But the value attribute does not work.

Any help is highly appreciated.
Kavitha

-----Original Message-----
From: Jacob Hookom [mailto:hookomjj@uwec.edu]
Sent: Tuesday, October 08, 2002 8:59 PM
To: 'Struts Users Mailing List'
Subject: RE: Pre-popluating the select dropdown.


That's because they usually end in "RTFM"

http://jakarta.apache.org/struts/doc-1.0.2/struts-html.html#options


| -----Original Message-----
| From: Kavitha Ranga [mailto:kavitha.ranganathan@wcom.com]
| Sent: Tuesday, October 08, 2002 7:50 PM
| To: 'Struts Users Mailing List'
| Subject: RE: Pre-popluating the select dropdown.
|
| I did not see any which solves my problem.I have also gone through the
| sample jsp which comes with Struts. Since my selected option is not
going
| to
| be the same all the time,I cannot set the value .It has to be
dyanamic.I
| have seen many people ask the same question but so far I have not seen
any
| answer.
|
| Kavitha
|
| -----Original Message-----
| From: Eddie Bush [mailto:ekbush@swbell.net]
| Sent: Tuesday, October 08, 2002 8:46 PM
| To: Struts Users Mailing List
| Subject: Re: Pre-popluating the select dropdown.
|
|
| Kavitha Ranga wrote:
|
| >I have a select dropdown in my JSP page.I retrieve the
| >data from the database and depending on the value I get back I have
| >to make that option as selected in my select dropdown.So the selected
| >option cannot be hardcoded.It has to be dynamic. I could not see any
of
| >the select attributes which can accomplish this.
| >Has anyone tried to do this on the jsp using Struts ?
| >
| Yes.  At least 3 people in the last two days have asked this question.
|  It's a popular one.  Did you try searching the archive?  Google?  Oh
| ... here's a fair one, I think:
|
|
http://www.mail-archive.com/struts-user@jakarta.apache.org/msg44110.html
|
| There are others:
|
| http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-
| 8&q=Struts+Default+Option
|
| Google does wonderous magic with the mail archive.  I have no clue how
| it finds such relevant posts, but it does a beautiful job of doing so.
|
| Hope that helps.
|
| --
| Eddie Bush
|
|
|
|
| --
| To unsubscribe, e-mail:
| <ma...@jakarta.apache.org>
| For additional commands, e-mail:
| <ma...@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:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Pre-popluating the select dropdown.

Posted by Jacob Hookom <ho...@uwec.edu>.
That's because they usually end in "RTFM"

http://jakarta.apache.org/struts/doc-1.0.2/struts-html.html#options


| -----Original Message-----
| From: Kavitha Ranga [mailto:kavitha.ranganathan@wcom.com]
| Sent: Tuesday, October 08, 2002 7:50 PM
| To: 'Struts Users Mailing List'
| Subject: RE: Pre-popluating the select dropdown.
| 
| I did not see any which solves my problem.I have also gone through the
| sample jsp which comes with Struts. Since my selected option is not
going
| to
| be the same all the time,I cannot set the value .It has to be
dyanamic.I
| have seen many people ask the same question but so far I have not seen
any
| answer.
| 
| Kavitha
| 
| -----Original Message-----
| From: Eddie Bush [mailto:ekbush@swbell.net]
| Sent: Tuesday, October 08, 2002 8:46 PM
| To: Struts Users Mailing List
| Subject: Re: Pre-popluating the select dropdown.
| 
| 
| Kavitha Ranga wrote:
| 
| >I have a select dropdown in my JSP page.I retrieve the
| >data from the database and depending on the value I get back I have
| >to make that option as selected in my select dropdown.So the selected
| >option cannot be hardcoded.It has to be dynamic. I could not see any
of
| >the select attributes which can accomplish this.
| >Has anyone tried to do this on the jsp using Struts ?
| >
| Yes.  At least 3 people in the last two days have asked this question.
|  It's a popular one.  Did you try searching the archive?  Google?  Oh
| ... here's a fair one, I think:
| 
|
http://www.mail-archive.com/struts-user@jakarta.apache.org/msg44110.html
| 
| There are others:
| 
| http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-
| 8&q=Struts+Default+Option
| 
| Google does wonderous magic with the mail archive.  I have no clue how
| it finds such relevant posts, but it does a beautiful job of doing so.
| 
| Hope that helps.
| 
| --
| Eddie Bush
| 
| 
| 
| 
| --
| To unsubscribe, e-mail:
| <ma...@jakarta.apache.org>
| For additional commands, e-mail:
| <ma...@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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Pre-popluating the select dropdown.

Posted by Kavitha Ranga <ka...@wcom.com>.
I did not see any which solves my problem.I have also gone through the
sample jsp which comes with Struts. Since my selected option is not going to
be the same all the time,I cannot set the value .It has to be dyanamic.I
have seen many people ask the same question but so far I have not seen any
answer.

Kavitha

-----Original Message-----
From: Eddie Bush [mailto:ekbush@swbell.net]
Sent: Tuesday, October 08, 2002 8:46 PM
To: Struts Users Mailing List
Subject: Re: Pre-popluating the select dropdown.


Kavitha Ranga wrote:

>I have a select dropdown in my JSP page.I retrieve the
>data from the database and depending on the value I get back I have
>to make that option as selected in my select dropdown.So the selected
>option cannot be hardcoded.It has to be dynamic. I could not see any of
>the select attributes which can accomplish this.
>Has anyone tried to do this on the jsp using Struts ?
>
Yes.  At least 3 people in the last two days have asked this question.
 It's a popular one.  Did you try searching the archive?  Google?  Oh
... here's a fair one, I think:

http://www.mail-archive.com/struts-user@jakarta.apache.org/msg44110.html

There are others:

http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=Struts+Default+Option

Google does wonderous magic with the mail archive.  I have no clue how
it finds such relevant posts, but it does a beautiful job of doing so.

Hope that helps.

--
Eddie Bush




--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Pre-popluating the select dropdown.

Posted by Eddie Bush <ek...@swbell.net>.
Kavitha Ranga wrote:

>I have a select dropdown in my JSP page.I retrieve the 
>data from the database and depending on the value I get back I have 
>to make that option as selected in my select dropdown.So the selected 
>option cannot be hardcoded.It has to be dynamic. I could not see any of 
>the select attributes which can accomplish this.
>Has anyone tried to do this on the jsp using Struts ?
>
Yes.  At least 3 people in the last two days have asked this question. 
 It's a popular one.  Did you try searching the archive?  Google?  Oh 
... here's a fair one, I think:

http://www.mail-archive.com/struts-user@jakarta.apache.org/msg44110.html

There are others:

http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=Struts+Default+Option

Google does wonderous magic with the mail archive.  I have no clue how 
it finds such relevant posts, but it does a beautiful job of doing so.

Hope that helps.

-- 
Eddie Bush




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: DynaActionForm

Posted by Dan Tran <da...@hotmail.com>.
Some code and struts config file may help to know where the error is

-D
----- Original Message -----
From: "kirusshna" <ki...@cyberpros-us.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Tuesday, October 08, 2002 5:49 PM
Subject: DynaActionForm


> Hi
>
> I tried to use the DynaActionForm and I get the following error :
>
> Exception creating bean of class org.apache.struts.action.DynaActionForm
>
> Any comments on this .
>
> Thanks
> kirusshna
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


DynaActionForm

Posted by kirusshna <ki...@cyberpros-us.com>.
Hi

I tried to use the DynaActionForm and I get the following error :

Exception creating bean of class org.apache.struts.action.DynaActionForm

Any comments on this .

Thanks
kirusshna


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>