其它标签
作者: 日期: 2007-4-5 14:19:00 访问次数:出处:
显示选项:自动滚屏[左键停止]
<h:messages>或<h:message>标签的介绍,在 错误讯息处理
<h:graphicImage>
这个标签会绘制一个HTML <img>标签,value可以指定路径或图片URL,路径可以指定相对路径或绝对路径,例如:
<h:graphicImage value="/images/logowiki.jpg"/>
<h:panelGrid>
这个标签可以用来作简单的元件排版,它会使用HTML表格标签来绘制表格,并将元件置于其中,主要指定columns属性,例如设定为 2:
<h:panelGrid columns="2">
<h:outputText value="Username"/>
<h:inputText id="name" value="#{userBean.name}"/>
<h:outputText value="Password"/>
<h:inputText id="password" value="#{userBean.password}"/>
<h:commandButton value="submit" action="login"/>
<h:commandButton value="reset" type="reset"/>
</h:panelGrid>
则自动将元件分作 2 个 column来排列,排列出来的样子如下:
<h:panelGrid>的本体间只能包括JSF元件,如果想要放入非JSF元件,例如简单的样版(template)文字,则要使用 <f:verbatim>包括住,例如:
<h:panelGrid columns="2">
<f:verbatim>Username</f:verbatim><h:inputText id="name" value="#{userBean.name}"/>
<f:verbatim>Password</f:verbatim><h:inputText id="password" value="#{userBean.password}"/>
<h:commandButton value="submit" action="login"/>
<h:commandButton value="reset" type="reset"/>
</h:panelGrid>
<h:panelGroup>
这个元件用来将数个JSF元件包装起来,使其看来像是一个元件,例如:
<h:panelGrid columns="2">
<h:outputText value="Username"/>
<h:inputText id="name" value="#{userBean.name}"/>
<h:outputText value="Password"/>
<h:inputText id="password" value="#{userBean.password}"/>
<h:panelGroup><h:commandButton value="submit" action="login"/>
<h:commandButton value="reset" type="reset"/>
</h:panelGroup> </h:panelGrid>
在<h:panelGroup>中包括了两个<h:commandButton>,这使得< h:panelGrid>在处理时,将那两个<h:commandButton>看作是一个元件来看待,其完成的版面配置如下所示:
⊕相关文章