发表于: java/j2ee | 作者: | 日期: 2008/3/14 09:03

虽然<html:text>标签会被翻译成HTML中的<text>标签,但它们的属性并非一一对应的关系。
简单总结了一下<html:text>常用的几个属性:

1、 property
对应到<text>标签的name属性,同时要与ActionForm子类中的字段对应。

2、 name
不与<text>标签的任何属性对应。仅对应存在于request或者session范围内的ActionForm的名字,然后会将<html:text>标签的默认值设置为property指定的属性的值。

3、 styleId
对应到<text>标签的ID属性。

4、 size
对应到<text>标签的size属性。

5、 maxlength
对应到<text>标签的maxlength属性。

6、 styleClass
对应到<text>标签的class属性,用来设置文本框的样式。

举个例子:
<html:text property=”phoneNo” styleId=”phoneNo” maxlength=”11″ size=”11″ styleClass=”input-write”></html:text>

会被翻译成如下形式:
<input type=”text” name=”phoneNo” maxlength=”11″ size=”11″ value=”” class=”input-write” id=”phoneNo”>

参考链接:http://struts.apache.org/1.1/userGuide/struts-html.html#text

: https://blog.darkmi.com/2008/03/14/59.html

本文相关评论 - 1条评论都没有呢
Post a comment now » 本文目前不可评论

No comments yet.

Sorry, the comment form is closed at this time.