Noel.

How would your original select look for the states?

I have a variable in the bean for state which is the value (i.e. "NY") but
not one for the state name (i.e. "New York").  My select is basic: 
<select name="state">
   <option value="NY">New York</option>
</select>

In my bean I have private String state; with the getter and setter methods.

Thanks.

Denise Mangano
Help Desk Analyst
Complus Data Innovations, Inc.


-----Original Message-----
From: Noel J. Bergman [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, January 02, 2003 6:04 PM
To: Tomcat Users List
Subject: RE: Easy question - Java Beans


Denise,

Start with your basic <select> tag, and then in your code that emits the
list of <option> tags, do something like this:

  <option value='" + stateCode + "'" + ((stateCode.equals(currentStateCode))
? " selected " : " ") + ">" + stateName + "</option>"

In other words, emit the

  <option value='NY'>New York</option>

tag, or the

  <option value='NY' selected>New York</option>

variant, depending upon whether the option you are about to emit is the
currently selected option.

        --- Noel


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to