JSF 2.x在空时隐藏消息层

时间:2013-02-21 13:39:45

标签: css jsf-2 icefaces

是否有一种方法可以在输出层为空时隐藏输出层(?如果这是正确的术语),这样当信息/错误消息写入它时,它会扩展到适合消息所需的高度,垂直拉伸它所包含的面板? (也许使用CSS ??)

<h:body>  
  <ace:panel>
...
...
    <h:panelGroup>   
      <h:messages
        infoStyle="color:darkgreen"
        errorStyle="color:darkred">
      </h:messages> 
    </h:panelGroup>   
  </ace:panel>
</h:body>

1 个答案:

答案 0 :(得分:1)

如果所有消息由同一个<h:messages>处理,您只需检查FacesContext#getMessageList()是否为空。

<ace:panel rendered="#{not empty facesContext.messageList}">