JSP SELECT 回显

1.使用JSTL 判断 选中:

 <select name="fellow.sex" disabled="disabled" value="${fellow.sex}">
	<option value="P">-请选择-</option>
	<option value="M" <c:if test="${'M' eq fellow.sex}">selected</c:if>>男</option>
	<option value="F" <c:if test="${'F' eq fellow.sex}">selected</c:if>>女</option>
 </select> 

 

2. 利用struts2 标签:

 

<s:select theme="simple" list="#{'P':'-请选择-','M':'男','F':'女'}" 
	listKey="key" listValue="value"
	name="fellow.sex" value="%{fellow.sex}"/>

 

 

 

 

 

你可能感兴趣的:(select)