【问题标题】:JSF render not working properlyJSF 渲染无法正常工作
【发布时间】:2013-03-03 13:58:58
【问题描述】:

无论 statusmsg、picstatus 或 videostatus 的值是否为 null,f:view <f:view rendered="#{p.statusmsg!=null}"><f:view rendered="#{p.picstatus!=null}"><f:view rendered="#{p.videostatus!=null}"> 中的所有内容都会被执行

1)getMoreStatusUpdate.xhtml

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:c="http://java.sun.com/jsp/jstl/core">

<h:head></h:head>
<h:body>
   <div id="content">
      <h:form>
         <ui:repeat var="p" value="#{statusBean.moreStatusList}">                   
            <f:view rendered="#{p.statusmsg!=null}">
            //Status content    
            </f:view>
            <f:view rendered="#{p.picstatus != null}"> 
            //Picture Status Content                            
            </f:view>  
            <f:view rendered="#{p.videostatus != null}">
            //Video Status Content
            </f:view>                   
         </ui:repeat>
      </h:form>
   </div>
</h:body>

【问题讨论】:

    标签: jsf jsf-2


    【解决方案1】:

    &lt;f:view&gt; doesn't 有一个 rendered 属性。

    此属性仅在基于UIComponent 的标签上受支持,这是h: library 的所有标签和ui: 库中的一些标签,包括&lt;ui:fragment&gt;

    只需将&lt;f:view&gt; 替换为&lt;ui:fragment&gt;

    另见:

    【讨论】:

    • 非常感谢。我希望你能回答,这样我就知道我的问题会一口气解决。我目前正在努力设计一个社交网站,您在互联网上的帖子和建议真的很有帮助。
    猜你喜欢
    • 2015-08-26
    • 2018-07-30
    • 2021-05-04
    • 1970-01-01
    • 1970-01-01
    • 2021-02-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多