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>
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>
相关文章推荐
- js获取select选中的标签option的值
- 用jquery获取select标签中选中的option值及文本
- bootstrap selectpicker 通过代码指定选中值 BootStrap selectpicker后台动态绑定数据 selectpicker 获取选中option的属性或者值
- 选择select 标签中指定值的option
- 解决如何通过循环来使用数据库的值设置jsp的select标签的option值
- ajax异步获取数据,动态添加select标签中的option
- html或jsp页面中select标签获取option值。
- 怎么从数据库里动态获取数据放置select 标签里
- js获取select选中的标签option的值
- jq获取HTML中select标签option值的操作
- IP定位:通过qqwry.bat IP库获取指定IP的地理位置信息
- 用jquery获取select标签中选中的option值及文本
- select标签,拉下获取数据,数据从数据库获取绑定
- struts2的select标签通过action获取数据库
- js获取select选中的标签option的值
- 获取页面中name相同的input或者select标签的option值
- js获取select选中的标签option的值
- JS获取select标签中option的个数
- 关于java 获取 html select标签 下拉框 option 文本内容 隐藏域
- 获取Select标签修改之前的值