先看以下这段代码:
<td><html:select property="studentID" styleClass="word" >
<html:option value="">select</html:option>
<html:optionsCollection name="studentForm" property="studentList" styleClass="word" />
</html:select></td>例如html:optionsCollection从数据库获取的记录有三条:
label="zhangsan" value="1"
label="lisi" value="2"
label="wangwu" value="3"
每次打开网页时,此下拉框都会显示第一项的内容"select",请问我如何才能让它显示数据库里保存的某一项的值?
辟如我数据库中studentID的值为2,就让它显示"lisi".
<td><html:select property="studentID" styleClass="word" >
<html:option value="">select</html:option>
<html:optionsCollection name="studentForm" property="studentList" styleClass="word" />
</html:select></td>例如html:optionsCollection从数据库获取的记录有三条:
label="zhangsan" value="1"
label="lisi" value="2"
label="wangwu" value="3"
每次打开网页时,此下拉框都会显示第一项的内容"select",请问我如何才能让它显示数据库里保存的某一项的值?
辟如我数据库中studentID的值为2,就让它显示"lisi".
解决方案 »
- 新手问下关于DWR的问题,请高人指点~
- 自增主键插入后如何获取主键
- struts2下的ectable的使用
- Help:Struts+Hibernate3页面显示空白
- 出错信息“Get Database connection:Cannot get a connection, pool exhausted”的问题
- javabean的class中可以调用一个函数,jsp页面中可以调用本页面函数么?
- 点Button后,为什么不能返回值给TextBox?
- 如何用javascript隐藏或灰掉ie的关闭按钮(X按钮)目的是不让用户非法关闭ie.
- 50分求一免费的上传下载组件
- git服务器上的代码pull不下来
- 求助jaspertreports&ireport的分页问题
- JSTL标签库问题,我想取request域或session域的bean,请问JSTL怎么写?(实现<jsp:userBean>功能)
你给property一个值,他会自动根据id把label找出来
reset(){
this.studentID="1";
}