<html:select><html:optionsCollection>中怎么取得数据库中对应值?

[color=red][/color]我在jsp页面中用了:
<html:select property="custLevelLabel" value="${customer.custLevelLabel}" size="1">
<html:optionsCollection name="level" label="dictItem" value="dictId"/>
</html:select>
用于取得数据库中数据库中数据,这点已经实现,已经把一列值取出并放入下拉列表。
这是一个编辑页面,也就是从一个列表页面跳转到这个页面(编辑页面代码如下):
<%@ page language="java" pageEncoding="UTF-8"%>

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html lang="true">
<head>
<html:base />

<title>客户信息</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->

<script type="text/javascript" src="../../../scripts/js/common.js"></script>
<link rel="stylesheet" href="../../../styles/css/style.css" type="text/css"></link>
<script type="text/javascript">
function showMessage(){
var msg=document.getElementById("lnkmsg").value;
showMsg(msg);
}
</script>
</head>

<body οnlοad="showMessage();">
<div class="page_title">客户信息管理 > 客户信息</div>
<html:form action="/updatecustomer.do?id=${custId}" method="post">
<div class="button_bar">
<html:button property="" styleClass="common_button" οnclick="help('');">帮助</html:button>
<html:button property="" styleClass="common_button" οnclick="to('linkman.do?id=${custId}');">联系人</html:button>
<html:button property="" styleClass="common_button" οnclick="to('activity.do?id=${custId}');">交往记录</html:button>
<html:button property="" styleClass="common_button" οnclick="to('orders.do?id=${custId}');">历史订单</html:button>
<html:button property="" styleClass="common_button" οnclick="back();">返回</html:button>
<html:submit property="submit" styleClass="common_button">保存</html:submit>
</div>
<logic:present name="customer">
<table class="query_form_table">
<tr>
<th>客户编号</th>
<td>${customer.custNo}</td>
<th>名称</th>
<td><html:text property="custName" value="${customer.custName}"></html:text><span class="red_star"></span></td>
</tr>
<tr>
<th>地区</th>
<td>
<html:select property="custRegion" value="${customer.custRegion}">
<html:optionsCollection name="region" label="dictItem" value="dictId"/>
</html:select>
<th>客户经理</th>
<td>
<html:select property="custManagerName" value="${customer.custManagerName}" size="1">
<html:optionsCollection name="mamager" label="usrName" value="usrId"/>
</html:select>
</td>
</tr>
<tr>
<th>客户等级</th>
<td>
<html:select property="custLevelLabel" value="${customer.custLevelLabel}" size="1">
<html:optionsCollection name="level" label="dictItem" value="dictId"/>
</html:select>
</td>
<th></th>
<td></td>
</tr>
<tr>
<th>客户满意度</th>
<td>
<html:select styleId="Satisfy" property="custSatisfy" size="1">
<html:option value="0">未指定</html:option>
<html:option value="5">☆☆☆☆☆</html:option>
<html:option value="4">☆☆☆☆</html:option>
<html:option value="3">☆☆☆</html:option>
<html:option value="2">☆☆</html:option>
<html:option value="1">☆</html:option>
</html:select>
</td>
<th>客户信用度</th>
<td>
<html:select styleId="Credit" property="custCredit" size="1">
<html:option value="0">未指定</html:option>
<html:option value="5">☆☆☆☆☆</html:option>
<html:option value="4">☆☆☆☆</html:option>
<html:option value="3">☆☆☆</html:option>
<html:option value="2">☆☆</html:option>
<html:option value="1">☆</html:option>
</html:select>
</td>
</tr>
</table>
<br />
<table class="query_form_table" id="table1">
<tr>
<th>地址</th>
<td><html:text property="custAddr" value="${customer.custAddr}"></html:text><span class="red_star">*</span></td>

<th>邮政编码</th>
<td><html:text property="custZip" value="${customer.custZip}"></html:text><span class="red_star">*</span></td>
</tr>
<tr>
<th>电话</th>
<td><html:text property="custTel" value="${customer.custTel}"></html:text><span class="red_star">*</span></td>

<th>传真</th>
<td><html:text property="custFax" value="${customer.custFax}"></html:text><span class="red_star">*</span></td>
</tr>
<tr>
<th>网址</th>
<td><html:text property="custWebsite" value="${customer.custWebsite}"></html:text><span class="red_star">*</span></td>
<th></th>
<td></td>
</tr>
</table>
<br />
<table class="query_form_table" id="table2">
<tr>
<th>营业执照注册号</th>
<td><html:text property="custLicenceNo" value="${customer.custLicenceNo}"></html:text></td>
<th>法人</th>
<td><html:text property="custChieftain" value="${customer.custChieftain}"></html:text><span class="red_star">*</span>
</td>
</tr>
<tr>
<th>注册资金(万元)</th>
<td>
<html:text property="custBankroll" value="${customer.custBankroll}"></html:text> </td>
<th>年营业额</th>
<td>
<html:text property="custTurnover" value="${customer.custTurnover}"></html:text>
</td>
</tr>
<tr>
<th>开户银行</th>
<td>
<html:text property="custBank" value="${customer.custBank}"></html:text><span class="red_star">*</span>
</td>
<th>银行帐号</th>
<td><html:text property="custBankaccount" value="${customer.custBankAccount}"></html:text><span class="red_star">*</span></td>
</tr>
<tr>
<th>地税登记号</th>
<td>
<html:text property="custLocaltaxno" value="${customer.custLocalTaxNo}"></html:text></td>
<th>国税登记号</th>
<td><html:text property="custNationaltaxno" value="${customer.custNationalTaxNo}"></html:text></td>
</tr>
</table>
</logic:present>
</html:form>
<input type="hidden" id="lnkmsg" value="${msg}">
</body>
</html:html>

其他的内容都能够从数据库读出,并正确显示,但就是那几个下拉列表不知如何让它选中数据库原有的对应值
请哪位高手解决一下,小弟万分感激。

昨天有位朋友说属性要与FormBean中的字段相同,我查了的
是相同的
而且,其他那些字段都能显示,就是那几个下拉列表不能选中对应数据库的值


[color=red]诸位的方法我都试过了
还是不行
关键我是先从其它表中读进一个集合
然后根据另一张表的信息而显示选中的具体内容[/color]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值