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.

select box problem

HjavaOct 26 2011 — edited Oct 27 2011
I have a simple drop down box with the select item out of db
like if the value in my db is i then the user will see two line of <option value="1">1</option>,
is that a simple way to handle this problem?
<select name="year">
                                        
                                        <option selected value="${found.year}"> <c:out value="${found.year}"/></option>
                                        <option  value="1">1</option>
                                        <option value="2">2</option>
                                        <option value="3">3</option>
                                        <option value="4">4</option>
                                        <option value="5">5</option>
                                        <option value="6">6</option>
                                    </select>
I don't want to use the method
<c:if test="${found.year=='1'}">
<option value="1" selected>1</option>
<c:if test="${found.year!='1'}">
<option value="1" >1</option>
since if the select list is long , like to 100 then the code will turn to every long , should be have a better way , is that right??

Comments

Processing
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Nov 24 2011
Added on Oct 26 2011
2 comments
176 views