Write the project today, encountered this problem, because the framework is 2005, JSP can not store tags, can only have Java code to write, the following is the example I wrote two examples can be successful!
Also wrote the use of the label in the JSP notation
writing Java code in a JSP
Method One:
State:
Copy Code code as follows:
<select name= "states" >
<option value= "0" <%= "0". Equalsignorecase (states)? " Selected ":" "%>> available </option>
<option value= "1" <%= "1". Equalsignorecase (states)? " Selected ":" "%>> not available </option>
</select>
Method Two:
Copy Code code as follows:
<tr>
<TD align= "Right" bgcolor= "f0f8ff" class= "TITLE-TD1" > Status </td>
<TD colspan= "2" class= "TITLE-TD2" >
<select name= "status" id= "status" >
<option value= "" >== Please choose ==</option>
<option value= "0" <%if (Log.getstatus (). Equals ("0")) {%> selected <%}%>> deactivate </option>
<option value= "1" <%if (Log.getstatus (). Equals ("1")) {%> selected <%}%>> normal </option>
</select>
</td>
</tr>
referencing labels in a JSP
Copy Code code as follows:
<%@ taglib prefix= "C" uri= "Http://java.sun.com/jsp/jstl/core"%>
<tr>
<td height= "align= right" class= "TD3" > class :</td>
<td align= "left "class=" Td4 ">
<select name=" state "class=" Search_input "onfocus=" This.si=this.selectedindex; "onchange=" this.selectedindex=this.si; " >
<option value= "" >== Please select ==</option>
<option value= "neighbourhood" <c:if test= "${smsname.state==" Neighborhood '} ' >selected</c:if> > Neighborhood Committee </option>
<option value= "community" <c:if test= "${smsname.state==" Community '} ' >selected</c:if>> community </option>
</select>
</td>
</tr>