有没有一种方法可以在输出层(?如果这是正确的术语)为空时隐藏它,以便在向其写入信息/错误消息时,它会垂直扩展到适合消息所需的高度拉伸(stretch)它所在的面板? (也许使用 CSS ??)
<h:body>
<ace:panel>
...
...
<h:panelGroup>
<h:messages
infoStyle="color:darkgreen"
errorStyle="color:darkred">
</h:messages>
</h:panelGroup>
</ace:panel>
</h:body>
最佳答案
前提是所有 消息都由同一个 <h:messages>
处理, 你可以只检查 FacesContext#getMessageList()
不为空。
<ace:panel rendered="#{not empty facesContext.messageList}">
关于css - JSF 2.x 在空时隐藏消息层,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15003724/