Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Radio Buttons and Select Lists in JSP

843836Nov 2 2004 — edited Nov 3 2004
Hi,

I need some help with Radio buttons and select lists. I have a registration page and I've stored the values in the database, which were taken from radio buttons and the select list.

I want to display the selected item in the radio button list and the select list, I am able to do that, but I want it to point to the entry in the existing list and not only display the value from the database. My code is iterating over the database value but not the list values, and I don't know how to do it

Here is my code to explain it more:

<c:when test="${row.choice == 'cars'}">
<input type="radio" name="cars" value="${fn:escapeXml(row.choice)}" checked><c:out value="${fn:escapeXml(row.choice)}"/>

<!-- Until this point it gives me the values from the database -->

<input type="radio" name="cars" value="mercedesl">Mercedes
<input type="radio" name="cars" value="ford">Ford
<input type="radio" name="cars" value="bmw">BMW
<input type="radio" name="cars" value="vw">Volkswagen

What I want it to do is get the value from the database, iterate through the list of existing values in the radio button selection and select/check the appropriate button instead of directly getting the information from the database.

The same goes for the following selection list:

<select name="Country">
<option value="${fn:escapeXml(row.country)}"><c:out value="${row.country}"/>

<option value="Albania">Albania
<option value="Austria">Austria
<option value="Belarus">Belarus
<option value="Belgium">Belgium
<option value="BozniaHerzegovina">Boznia and Herzegovina
<option value="Bulgaria">Bulgaria
<option value="Croatia">Croatia
<option value="CzechRepublic">Czech Republic

I don't really know how to continue to get it to point to the values I want.

Can someone help me out? I would really appreciate it...

Thank you
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 1 2004
Added on Nov 2 2004
2 comments
561 views