您的位置:首页 > 数据库

select标签,获取数据库中的值作为option. 修改时定位在指定位置

2012-04-19 09:42 483 查看
insert.java中,查询到的结果集,压缩到对象iType中

insert.jsp中,代码如下:

<select name="profession" id="profession">

<logic:presentname="iType">

<logic:iterateid="p"name="iType">

<logic:presentname="p">

<bean:defineid="i"
name="p"property="industyType"/>

<option value="<%=i.toString()%>"><%=i.toString()%>
</option>

</logic:present>

</logic:iterate>

</logic:present>

</select>

update.jsp中,代码如下:(做一下比较,如果该option和存储的值一样,就定位在此option这上)

<select name="memtype" id="memtype">

<logic:present name="mType">

<logic:iterate id="p" name="mType">

<logic:present name="p">

<bean:define id="t" name="p" property="membertype"/>

<option value="<%=t.toString()%>" <%if(t.toString().equals(m.toString())) {out.print(" selected");} %>><%=t.toString()%></option>

</logic:present>

</logic:iterate>

</logic:present>

</select>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: