问题描述
我正在尝试有条件地渲染 我目前的(工作)方法如下: 这有效,但我不确定这是否是滥用 我也阅读了这个问题的答案,但如上所述,由于 显然你没有仔细测试它. 因此,这在技术上应该可以正常工作. 顺便说一下,这也可以使用 I'm trying to conditionally render a My current (working) approach is the following: This works, but I'm not sure if that's the way to abuse I have also read the answers to this question, but as mentioned above, they won't work for me because of the Apparently you didn't test it carefully. The Thus, this should technically perfectly work fine. However, better for the main purpose would be to use This is by the way also possible with 这篇关于非 JSF 组件的条件渲染(普通 HTML 和模板文本)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 因此我不能使用 因为它会渲染到
;或
<tr>我的东西</tr></h:outputFormat>
<h:outputFormat>
的方式 - 在此之前我使用了 <h:outputLabel>
但是这在 IE 中被渲染为 .
<tr>
:如何在 JSF 中不渲染整个块?<h:panelGroup>
如果您不指定应该在客户端结束的属性,例如 layout
、id
,则不会呈现任何内容、styleClass
等<tr>我的东西</tr></h:panelGroup>
<tr>我的东西</tr></ui:fragment>
,但自 JSF 2.0 起已弃用,因为它专为在 JSP 中使用而设计.
另见:
<tr>
therefore I cannot use <h:panelGroup>
as it will render to <span> or <div>
<h:outputFormat rendered="#{negotiator.maySend}">
<tr> my tr stuff </tr>
</h:outputFormat>
<h:outputFormat>
- before that I used <h:outputLabel>
but this was rendered to <label>
in IE.<tr>
: How to not render whole block in JSF?<h:panelGroup>
won't render anything if you don't specify attributes which should end up in the client side, like layout
, id
, styleClass
, etc.<h:panelGroup rendered="#{negotiator.maySend}">
<tr> my tr stuff </tr>
</h:panelGroup>
<ui:fragment>
.<ui:fragment rendered="#{negotiator.maySend}">
<tr> my tr stuff </tr>
</ui:fragment>
<f:verbatim>
, but this is deprecated since JSF 2.0 as it's designed specifically for usage in JSP.See also: