Struts Html 标签Bug

今天碰到一问题,弄了很久,最后发现应该是struts html标签工作不稳定造成。说得不对的地方大家包涵。
我有一表单,如下:
< html:form   action = " /ClinicOutcome.do?operate=save "   onsubmit = " return validateClinicOutcomeForm(this); " >
....
< td class = " label " >
    
< html:select  property = " outcomeType "   >
        
< html:option value = " -请选择- " > -请选择- </ html:option >
            
< html:option value = " 1 " > 血透 </ html:option >
            
< html:option value = " 2 " > 腹透 </ html:option >
            
< html:option value = " 3 " > 移植 </ html:option >
            
< html:option value = " 4 " > 肾功能恢复 </ html:option >
            
< html:option value = " 5 " > 死亡 </ html:option >
            
< html:option value = " 6 " > 失访 </ html:option >
            
<!--   < html:options collection = " groupList "  property = " id "  labelProperty = " grpName "   />   -->
        
</ html:select >
</ td >


< td  colspan = ' 4 '  align = " left "  class = " label " >
     
< html:textarea property = " dialyseResumeReason "   cols = " 60 "  rows = " 2 "   />
</ td >

....

</ html:form >
 
数据的录入没有任何问题,数据表中可以找到我录入的数据,但是,当查看录入的内容时,发现 html:select 还有html:textarea内容都无法显示出来。
查阅 struts标签文档,是这样描述的:
<html:select />
The <html:select /> tag is used to render an HTML <input> element with an input type of select. The
<html:select /> has a body type of JSP and supports 28 attributes, described in Table 14.12.
Note The <html:select /> tag must be nested inside the body of an <html:form /> tag.

The <html:textarea /> tag is used to render an HTML <input> element with an input type of textarea. The
<html:textarea /> has a body type of JSP and supports 29 attributes, described in Table 14.21.
其中 value属性介绍如下:
Specifies the value of this input element. If the ActionForm bean associated with the parent <html:form /> tag has a property that matches the value attribute, then the value of the ActionForm bean property will be used as the value of this attribute.(Optional)
也就是说,value属性是可选的,只要在bean中匹配到一样的属性名字,那么默认将其作为这个属性的值。

我在我上面的那几句代码里加上value,问题则得到解决。
value="${bean.****}".
导致这种问题出现的原因只是我的猜想,不对的地方大家帮忙纠正,谢谢!
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值