JSF标签

JSF 标准标签

<h:column> <h:commandButton> <h:commandLink> <h:dataTable> <h:form> <h:graphicImage> <h:inputHidden> <h:inputSecret>
<h:inputText> <h:inputTextarea> <h:message for=""> <h:messages> <h:outputFormat> <h:outputLabel> <h:outputLink>
<h:outputText> <h:panelGrid> <h:panelGroup> <h:selectBooleanCheckbox> <h:selectManyCheckbox> <h:selectManyListbox>
<h:selectManyMenu> <h:selectOneListbox> <h:selectOneMenu> <h:selectOneRadio>

<f:actionListener> <f:attribute> <f:convertDateTime> <f:converter ><f:convertNumber> <f:facet name="">
<f:loadBundle var="" basename=""> <f:param> <f:phaseListener> <f:selectItem><f:selectItems>
<f:setPropertyActionListener target="" value=""> <f:subview id=""> <f:validateDoubleRange>
<f:validateLength><f:validateLongRange><f:validateRegex pattern="" binding=""><f:validator><f:valueChangeListener>
<f:verbatim><f:view><f:viewParam>

JSF标准HTML标签包括了几个通用的属性
id 所有组件 可指定id名称,以让其它标签或组件参考
binding 所有组件 绑定至UIComponent
rendered 所有组件 是否显示组件
styleClass 所有组件 设定Cascading stylesheet(CSS)
value 输入、输出、命令组件 设定值或绑定至指定的值
valueChangeListener 输入组件 设定值变事件处理者
converter 输入、输出组件 设定转换器
validator 输入组件 设定验证器
required 输入组件 是否验证必填输入框
immediate 输入、命令组件 是否为即时事件


1、inputTextarea
常用属性:cols Rows
常用的写法:<h:inputTextarea value="" rows="8" style="width:100%" />

2、inputText
常用属性:readonly
Size 框的大小 Maxlength 最多字符数
常用的写法:<h:inputText size="5" readonly="true" Maxlength="6" style="color:yellow;"/>

3、<h:inputHidden> <input type="text">标签

4、<h:inputSecret> <input type="password">标签

5、outputText
常用属性:escape 如果设置为true,会转义<、>和&字符。默认值为false
使用举例:
<h:outputText value="outputtext" style="height:30;width:100%;text-align:center;" />

6、outputFormat
此标签用于tag体中指定的参来格式化组合的消息,
例如:
<h:outputFormat value="{0} is {1} years old!" >
<f:param value="Bill" />
<f:param value="38" />
</h:outputFormat>
{0}与{1}会被取代为<f:param>设定的文字

<f:loadBundle basename="messages" var="msgs"/>
<h:outputFormat value="#{msgs.welcomeText}">
<f:param value="Hello"/>
<f:param value="Guest"/>
</h:outputFormat>
messages.properties包括以下的内容:
welcomeText={0}, Your name is {1}.则{0}与{1}会被取代为<f:param>设定的文字

7、graphicImage HTML<img>标签
常用例子:
<h:graphicImage value="/tjefferson.jpg" style="border:thin solid black" />

8、commandButton
常用属性:Type (button,reset,submit) 默认submit
使用举例:
<h:panelGrid columns="2" align="center">
<h:commandButton value="确认" action="" styleClass="button" style="margin-right:10px"/>
<h:commandButton value="取消" action="" styleClass="button" />
</h:panelGrid>

9、commandLink HTML标签<a>
href='#',onclick属性会含有一段JavaScript程序,点击自动提交表(其作用就像按钮,但外观却是超链接)
使用举例:
<h:commandLink>
<h:outputText value="welcome"/>
<f:param name="locale" value="zh_CN"/>
</h:commandLink>

10、outputLink HTML标签<a>
使用举例:
<h:outputLink value="../index.jsp">
<h:outputText value="Link to Index"/>
<f:param name="name" value="MyName"/>
</h:outputLink>

11、selectBooleanCheckbox 复选框(单个的)
value所绑定的属性必须接受与传回boolean类型
使用举例:
我同意 <h:selectBooleanCheckbox value="#\{user.aggree\}"/>

12、selectManyCheckbox 一组复选框

itemDisabled=true 禁用选择项
使用举例:
<h:selectManyCheckbox value="#{form.colors}" >
<f:selectItem itemValue="红" />
<f:selectItem itemValue="蓝" />
<f:selectItem itemValue="黄" />
<f:selectItem itemValue="绿" />
<f:selectItem itemValue="橙黄" />
</h:selectManyCheckbox>

13、selectManyListbox 多选列表
<h:selectManyListbox size="5" >
<f:selectItem itemValue="1900" itemLabel="1900" />
<f:selectItem itemValue="1901" itemLabel="1901" />
<f:selectItem itemValue="1902" itemLabel="1902" />
<f:selectItem itemValue="1903" itemLabel="1903" />
</h:selectManyListbox>

14、<h:selectManyMenu>

15、selectOneRadio 单选按钮
使用举例:
<h:selectOneRadio>
<f:selectItem itemValue="0" itemLabel="全体人员" />
<f:selectItem itemValue="1" value="true" itemLabel="HR人员" />
</h:selectOneRadio>

16、selectOneListbox 单选列表
<h:selectOneListbox size="5" >
<f:selectItem itemLabel="1900" itemValue="1900"/>
<f:selectItem itemLabel="1901" itemValue="1901"/>
<f:selectItem itemLabel="1902" itemValue="1902"/>
<f:selectItem itemLabel="1903" itemValue="1903"/>
</h:selectOneListbox>

17、<h: selectOneMenu>

18、<h:panelGroup>
将数个JSF组件包装起来,使其看来像是一个组件


19、<h:panelGrid>
常用属性:columns 它会使用HTML表格标签来绘制表格

20、<h:dataTable>简单的表格

19、<h:column>

21、<h:form>

22、<h:message for="">

23、<h:messages>

24、<h:outputLabel>

<f:facet name="[header-footer]">表头、表尾
常用属性:name (header表头 footer表尾)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值