如何隐藏h:有条件地输出链接



我如何根据背bean中的布尔来隐藏 h:ouputLink

因为我这样禁用它:

<h:commandButton disabled="#{backing.property}" />

但是我该如何完全隐藏?

with:

<h:commandButton id="myComponent" rendered="#{backing.property}" />

对不起,我的错。您正在搜索H:outputLink。因为两个 h:outputLink h:commandbutton 均来自uicomponentbase,所以两个派生的类都有方法isRendered(),并且您无需将命令链接包装在某种面板中。<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

<h:outputLink rendered="#{backing.property}" />

update

myComponent 将由于不会渲染而被"隐藏"。不要渲染 myComponent 表示您需要在 myComponent myComponent 上进行更新(例如,使用AJAX请求)进行更新(例如/p>

<h:panelGrid id="myPanelGrid">
  ....
  <h:outputLink id="myComponent" rendered="#{backing.property}" />
  ....
<h:panelGrid>
<h:commandButton value="show" action="#{backing.setPropertyToTrueMethod}" update="myPanelGrid" />

请参阅API规范:Javatm平台,Enterprise Edition 6 API规范

最新更新