Spring 表单 文本框 readonly的设置

来源:互联网 发布:mac的pages怎么转word 编辑:程序博客网 时间:2024/05/16 05:02

刚开始用spring表单,想把文本框设置为只读,用readonly="readonly" 设置了半天,还是可以编辑该文本框。


在网上搜索了很久都没有解决方法,最后到spring的网站,看了他们的说明文档才知道,spring表单的input是不支持readonly="readonly"的。


只支持readonly="true" 或者readonly="false" ,这样才可以设置文本框的只读属性。


以下是input标签的一些说明:

E.7. The input tag

Renders an HTML 'input' tag with type 'text' using the bound value.

Table E.6. Attributes

AttributeRequired?Runtime Expression?Description

accesskey

false

true

HTML Standard Attribute

alt

false

true

HTML Optional Attribute

autocomplete

false

true

Common Optional Attribute

cssClass

false

true

Equivalent to "class" - HTML Optional Attribute

cssErrorClass

false

true

Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors.

cssStyle

false

true

Equivalent to "style" - HTML Optional Attribute

dir

false

true

HTML Standard Attribute

disabled

false

true

HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element.

htmlEscape

false

true

Enable/disable HTML escaping of rendered values.

id

false

true

HTML Standard Attribute

lang

false

true

HTML Standard Attribute

maxlength

false

true

HTML Optional Attribute

onblur

false

true

HTML Event Attribute

onchange

false

true

HTML Event Attribute

onclick

false

true

HTML Event Attribute

ondblclick

false

true

HTML Event Attribute

onfocus

false

true

HTML Event Attribute

onkeydown

false

true

HTML Event Attribute

onkeypress

false

true

HTML Event Attribute

onkeyup

false

true

HTML Event Attribute

onmousedown

false

true

HTML Event Attribute

onmousemove

false

true

HTML Event Attribute

onmouseout

false

true

HTML Event Attribute

onmouseover

false

true

HTML Event Attribute

onmouseup

false

true

HTML Event Attribute

onselect

false

true

HTML Event Attribute

path

true

true

Path to property for data binding

readonly

false

true

HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will make the HTML element readonly.

size

false

true

HTML Optional Attribute

tabindex

false

true

HTML Standard Attribute

title

false

true

HTML Standard Attribute

网址为:

http://static.springsource.org/spring/docs/2.0.x/reference/spring-form.tld.html#spring-form.tld.input


原创粉丝点击