前言
这个技术已经非常老旧,属于日本还在使用,或者一些老项目还在使用。
No | 标签 | 描述 | 使用例子 |
---|---|---|---|
1 | <f:actionListener> | 为h:commandLin,h:commandButton等指定自定义的事件监听类 | <h:commandButton id="regist" value="Regist"> <f:actionListener type="mypackage.ActionListenerImpl"></f:actionListener> </h:commandButton> |
2 | <f:attribute> | 设置父标签的属性 | <h:grahicImage url="/img/hikktn.jpg"> <f:attribute name="height" value="30"></f:attribute> </h:grahicImage> |
3 | <f:convertDateTime> | 转换日期格式 | <h:outputText value="#{bean.outDate}"> <f:convertDateTimeTime pattern="yyyy年MM月dd日"></f:convertDateTime> </h:outputText> |
4 | <f:converter> | 调用converter-id的JSF Conerter组件实现(javax.faces.convert.Conerter) 能够将JSF组件的输入输出值加以变换 |
<h:inputText value="123456"> <f:converter converterId="myConverterID"></f:converter> </h:inputText> |
5 | <f:convertNumber> | 对数字、货币符号进行格式转换 | <h:inputText value="123456"> <f:convertNumber type="currency" currencySYmbol="$"></f:convertNumber> </h:inputText> |
6 | <f:facet> | 只要有f:face标签的父组件,和子组件f:face标签有一种特殊关系。常和h:panelCrid,h:dataTable等标签连用,申明组件为标签或页脚 | <f:facet name="header"> <h:outputText value="title"/> <f:facet> |
7 | <f:loadBundle> | JSF提供的一个支持JSP本地化(多语言支持)操作的标签 | <f:loadBundle basename="com.test.resouce.Messages" var="msg"/> |
8 | <f:param> | 向组件添加参数 | <h:outputLink value="/someUrl"> <f:param name="id" value="#{bean.id}" /> <f:param name="name" value="#{bean.name}"/> </h:outputLink> 或者 <h:outputFormat value="You have {0} items in your shopping cart"> <f:param value="#{SessionBean.cart.itemCount}"/> </h:outputFormat> |
9 | <f:selectItem> | 指定UISelectOne或UISelectMany组件的一个项目,用来为h:selectOneMenu等选择性组件设置数据项 | <h:selectOneMenu value="#{bean.selectItemValue"}> <f:selectItem itemLabe="Label1" value="0"/> <f:selectItem itemLabe="Label2" value="1"/> </h:selectOneMenu> |
10 | <f:selectItems> | 多了组件设置 h:selectManyCheckbox h:selectManyListbox h:selectManyMenu h:selectOneMenu h:selectOneListbox h:selectOneRadio |
|
11 | <f:subview> | 指定的JSF页面,或者其他JSF组件 使用f:subview包含JSF页面时,被包含的页面里面只能包含有JSF组件,所有非JSF组件元素必须用f:subview标签进行转换 |
<f:subview id="id"> <%@include file="subpage.jsp" %> </f:subview> |
12 | <f:vaildateDoubleRange> | 可以对所有输入类型的组件的输入值加以验证。 | <h:inputText id="amount" value="#{mybean.amount}" required="true"> <f:vaildateDoubleRange maximum="2500.8" minimum="0.00"></f:vaildateDoubleRange> </h:inputText> |
13 | <f:vaildateLength> | <h:inputText id="userId" value="#{mybean.userId}" required="true"> <f:vaildateLength maximum="16" minimum="8"></f:vaildateLength> </h:inputText> |
|
14 | <f:vaildateLongRange> | 可以对所有输入类型的组件的输入值加以验证。 | <h:inputText id="amount" value="#{mybean.amount}" required="true"> <f:vaildateLongRange maximum="2500" minimum="800"></f:vaildateLongRange> </h:inputText> |
15 | <valueChangeListener> | 向父组件注册值添加变更监听器 | <h:selectBooleanCheckbox id="id" value="#{pc_Attribute.selected}" valueChangeListener="#{pc_Attribute.onOperateSelcetedChange}" οnclick="submit();"></h:selectBooleanCheckbox> |
16 | <f:verbatim> | 输出标签 | <f:verbatim><li/></f:verbatim> |
17 | <f:view> | 创建顶层视图 | <html> <body> <f:view> <h:column> <h:outputText value="#{user.name}" /> </h:column> </f:view> </body> </html> |
JSF HTML标签
No | 标签 | 描述 | 使用例子 |
---|---|---|---|
1 | <h:dataTable> | 配合<h:column>标签以表格显示数据。 | <h:dateTable value="#{tableBean.userList}" var="user"> </h:dateTable> |
2 | <h:commandButton> | 显示一个命令按钮,输出<input>HTML标签,其type属性可以设定为button,submit或者reset,当属性是submit,按下按钮会触发javax.faces.event.ActionEvent | <h:commandButton value="提交" action="#{user.userId}"></h:commandButton |
3 | <h:commandLink> | 生成超链接,会输出<a>标签,而href属性会有'#' | <h:commandLink value="#{msg.commandText}" action="#{user.userId}"/> |
4 | <h:form> | 和HTML里面的form一样用于表单提交 | |
5 | <h:graphicImage> | 绘制一个HTML<img>标签,value指定路径或图片URL,路径可以指定相对路径或绝对路径 | <h:graphicImage value="/img/hikktn.jpg"/> |
6 | <h:inputHidden> | 隐藏输入框,即输出<input>标签,其type属性设定为hidden,隐藏输入框的只用于保留一些与客户端,在下一次发送表单时提交 | <h:inputHidden value="#{user.hiddenInfo}"/> |
7 | <h:inputSecret> | 显示密码输入框,即输出<input>标签,其type属性设置为password。可以设定redisplay属性来决定是否要显示密码栏目的值,默认为false | <h:inputSecret value="#{user.password}"/> |
8 | <h:inputText> | 显示单行输入框,即<input>标签,type属性设置为text | <h:inputText value="#{user.name}"/> |
9 | <h:inputTextarea> | 显示多行输入文字区域,即<textarea>标签 | <h:inputTextarea value="#{user.command}"/> |
10 | <h:message> | 显示一个组件最近使用的消息 | <h:inputText id="id"/> <h:message id="message" showSummary="false" showDetail="true"/> |
11 | <h:messages> | 显示所有消息 | <h:messages id="messageAll" showDetail="true" showSummary="true"/> |
12 | <h:outputFormat> | 生成指定的文字,可以搭配<param>来设定的参数以格式化文字 | <h:outputFormat value="#{msgs.welcomText}"> <f:param value="hello"/> <f:param value="world"/> </h:outputFormat> |
13 | <h:outputLabel> | 生成<label>标签。 | <h:inputText id="user" value="#{user.name}"/> <h:outputLabel for="user" value="#{user.name}"/> |
14 | <h:outputLink> | 生成<a>标签。 | <h:outputLink value="/index.jsp" /> <h:outputText value="Link to Index"/> <f:param name="name" value="MyName"/> </h:outputLink> |
15 | <h:outputText> | 显示指定或者绑定的值 | <h:outputText value="#{user.name}"/> |
16 | <h:panelGrid> | 用作简单的组件排版,它会使用HTML表格标签来绘制表格,并将组件置于其中。 | <h:panelGrid columns="2"> <h:outputText value="username"/> <h:inputText id ="name" value="#{userBean.name}"/> </h:panelGrid> |
17 | <h:panelGroup> | 用来将数个JSF组件封装起来,使其看起来像一个组件 | <h:panelGroup> <h:commandButton value="submit" action="login"/> </h:panelGroup> |
18 | <h:selectBooleanCheckbox> | 在视图上呈现一个复选框 | <h:selectBooleanCheckbox value="#\{user.aggress\}"> |
19 | <h:selectManyCheckbox> | 提供使用者复选项目的功能 | <h:selectManyCheckbox layout="pageDirection" value="#{user.preferColors}"> <f:selectItem itemLabel="红" itemValue="false"/> <f:selectItem itemLabel="蓝" itemValue="false"/> </h:selectManyCheckbox> |
20 | <h:selectManyListbox> | 提供使用者复选项目的功能 | <h:selectManyListbox layout="pageDirection" value="#{user.preferColors}"> <f:selectItem itemLabel="红" itemValue="false"/> <f:selectItem itemLabel="蓝" itemValue="false"/> </h:selectManyListbox> |
21 | <h:selectManyMenu> | 提供使用者复选项目的功能 | <h:selectManyMenu layout="pageDirection" value="#{user.preferColors}"> <f:selectItem itemLabel="红" itemValue="false"/> <f:selectItem itemLabel="蓝" itemValue="false"/> </h:selectManyMenu> |
22 | <h:selectOneListbox> | 单选列表框 | <h:selectOneListbox layout="pageDirection" value="#{user.preferColors}"> <f:selectItem itemLabel="红" itemValue="false"/> <f:selectItem itemLabel="蓝" itemValue="false"/> </h:selectOneListbox> |
23 | <h:selctOneMenu> | 下拉框 | <h:selctOneMenu layout="pageDirection" value="#{user.preferColors}"> <f:selectItem itemLabel="红" itemValue="false"/> <f:selectItem itemLabel="蓝" itemValue="false"/> </h:selctOneMenu> |
24 | <h:selectOneRadio> | 单选按钮框,类似于<input type="radio"/> | <h:selectOneRadio layout="pageDirection" value="#{user.preferColors}"> <f:selectItem itemLabel="红" itemValue="false"/> <f:selectItem itemLabel="蓝" itemValue="false"/> </h:selectOneRadio> |