struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joe Barefoot" <Joe.Baref...@motiva.com>
Subject RE: Pre-popluating the select dropdown.
Date Wed, 09 Oct 2002 00:53:08 GMT
I beg to differ.  

The message Eddie posts solves your problem:

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

In your action class: when you get your data from the DB and decide which option is to be
selected, set the property in your form bean that you are using for the <html:select>
to the option value you wish to be selected, then forward to the JSP.  Struts will mark the
option whose value matches the property's value to be the selected option in the html.  

peace,
Joe

> -----Original Message-----
> From: Kavitha Ranga [mailto:kavitha.ranganathan@wcom.com]
> Sent: Tuesday, October 08, 2002 5: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/msg
44110.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:
<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