struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hunter Hillegas <li...@lastonepicked.com>
Subject Re: Usage of html:select
Date Mon, 21 Apr 2003 21:51:46 GMT
I think that gets me part of the way there...

The other half is having the item that was selected in the form come up as
the select item in the map. I.e. if they picked California, when it comes
back, that is the one selected...

This is usually achieved by adding the keyword "selected" to the <option/>
tag... With the old JSP, I had a conditional check each time to see if it
should be inserted.

I don't know what the best practice is for this and I don't see a way to
accomplish that here.

How have others tackled this?

Thanks,
Hunter

> From: Josh Rayls <jrayls@crunchtime.com>
> Reply-To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
> Date: Mon, 21 Apr 2003 17:24:03 -0400
> To: "'Struts Users Mailing List'" <struts-user@jakarta.apache.org>
> Subject: RE: Usage of html:select
> 
> Example:
> 
>     <html:select property="locationId">
>      <html:option value="">--</html:option>
>      <html:options collection="locationMap" property="key"
> labelProperty="value"/>
>     </html:select>
> 
> Where locationMap is a request scoped Map keyed by {key, value}.  Create the
> actual Map in your action class, and put it into the request via
> request.setAttribute(key, value).
> 
> Hope that helps.
> 
> -Josh
> 
> -----Original Message-----
> From: Hunter Hillegas [mailto:lists@lastonepicked.com]
> Sent: Monday, April 21, 2003 5:22 PM
> To: Struts List
> Subject: Usage of html:select
> 
> 
> Is there some documentation available with examples for html:select and
> html:option? I've seen the list of parameters, but I was hoping for
> examples.
> 
> Right now we do this:
> 
> <SELECT name="company_state">
> <OPTION VALUE="AL" <% if (customerBean.getState().equals("AL")) {
> %>selected<% } %>>Alabama</OPTION>
> 
> <OPTION VALUE="AK" <% if (customerBean.getState().equals("AK")) {
> %>selected<% } %>>Alaska</OPTION>
> </SELECT>
> 
> Which is total garbage. I'd like to use the Struts tags, but I'm not getting
> a good mental picture of how these two specific tags work from what I've
> read and seen.
> 
> Thanks,
> Hunter
> 
> 
> ---------------------------------------------------------------------
> 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


Mime
View raw message