关于Struts标签的问题

来源:百度知道 编辑:UC知道 时间:2024/05/11 17:02:27
<html:select name="contractinfo" property="cclass">
<html:options collection="contractclass" property="numbers" labelProperty="names"/>
</html:select>
其中:contractinfo 是合同表中的数据,property="cclass" 既 合同表中的cclass字段(合同类别id)
contractclasss 是合同类别表中的数据,property="numbers"既 合同类别表中的numbers 字段(合同类别id),labelProperty="names" 对应的合同类别的名字
大家也都知道这个是个下拉框.
但是在一地方我不需要下拉框,需要<td>类别名</td> 这样的效果,那用什么样的Struts标签 做出来!
leichenlei :<bean:write name=contractinfo property="cclass"> 这样读出来的只是类别ID,我需要对应的类别名字!这是2个表,合同表里的cclass 是类别ID,需要和合同类别表连接,合同类别表中的类别id字段是:numbers,读出对应类别名字names

a.jsp 中:
<html:select name="合同信息" property="合同类型id">
<html:options collection="合同类型集合" property="合同类型id" labelProperty="合同类型name"/>
</html:select>

你要求的是:当你为一个合同选择一个类型后
要在提交的页面(b.jsp)用出现:
<br><br>
<table border = 1>
合同信息
<tr>
<td>合同类型</td>
<td>合同类型name</td>
</tr>
</table>
<br><br>
这样的,对吗?

我是这样想的:在a.jsp提交后的action中,根据 合同类型id 得到 合同类型name(搜索数据库或是迭代 合同类型集合 ),
然后把 合同类型name 存到request 中,然后再在 b.jsp中用 <bean:write property="合同类型name">显示出来。

还有如果你保存合同信息的 XxxActionForm 的 合同类型id 属性是String 类型的话,
你也可以考虑直接把 合同类型name 存到 合同类型id 中,这样就直接用 <bean:write name=合同信息 property="合同类型id">输出就可以了。

至于你说的: 那用什么样的Struts标签 做出来!
实在是没辙。
因为你如果在b.jsp 中仍旧用
<html:select name="合同信息" property=&qu