
如果使用的是JSF2 Facelets,则可以仅使用纯HTML设计表单,并使用
jsfc属性指定在JSF运行时应使用的相应JSF组件。例如
<form jsfc="h:form"> <label jsfc="h:outputLabel" for="input1" /> <input type="text" jsfc="h:inputText" id="input1" value="#{bean.input1}" required="true" /> <span jsfc="h:message" for="input1" /> <input type="submit" jsfc="h:commandButton" value="Submit" action="#{bean.submit}" /></form>阅读Facelets
<ui:xxx>taglib文档也应该提供一些见解。例如
<span jsfc="ui:remove"> This is present during design time, but is removed during JSF runtime.</span><div jsfc="ui:repeat" value="#{bean.items}" var="item">#{item}</div><table> <tr jsfc="ui:repeat" value="#{bean.items}" var="item"> <td>#{item.id}</td> <td>#{item.name}</td> </tr></table>以及您可以
<ui:composition>用来指定Facelet合成的开始和结束(例如,包含文件或标记文件)的事实。运行时将忽略外部的任何内容,但是您仍然可以在设计时添加一些HTML,以便可以轻松预览应该包含文件或标记文件的完整设计。
<!DOCTYPE html><html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"> <head> ... </head> <body> ... <ui:composition> Here you can design content of include file or tag file as if it's part of the whole design. </ui:composition> ... </body></html>
所有这些都使您无需JSF运行时即可预览HTML / CSS设计。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)