今天碰到一问题,弄了很久,最后发现应该是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
>
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
<
td colspan
=
'
4
'
align
=
"
left
"
class
=
"
label
"
>
<
html:textarea property
=
"
dialyseResumeReason
"
cols
=
"
60
"
rows
=
"
2
"
/>
</
td
>
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
....
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
</
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.****}".
导致这种问题出现的原因只是我的猜想,不对的地方大家帮忙纠正,谢谢!
我有一表单,如下:
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
数据的录入没有任何问题,数据表中可以找到我录入的数据,但是,当查看录入的内容时,发现 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.****}".
导致这种问题出现的原因只是我的猜想,不对的地方大家帮忙纠正,谢谢!