【问题标题】:How to load a JSF 2.0 composite component via AJAX如何通过 AJAX 加载 JSF 2.0 复合组件
【发布时间】:2012-04-22 06:49:16
【问题描述】:

我设计了一个看起来像这样的复合组件:

 <cc:interface>
    <cc:attribute name="value" required="true" />
    <cc:attribute name="title" required="true" />
</cc:interface>

<!-- IMPLEMENTATION -->
<cc:implementation>
    <div class="inputTile">
        <div class="inputTitle">
            <span>#{cc.attrs.title}</span>
        </div>
        <div class="inputTileContent">
            <input type="text" value="#{cc.attrs.value}" />
        </div>

    </div>
</cc:implementation>

我正在尝试通过 AJAX 将其加载到我的网页上的 div 中。

关于如何做到这一点的任何想法?

【问题讨论】:

  • “加载到 div 中”是什么意思?

标签: ajax jsf jsf-2


【解决方案1】:

可能是这样的吗?

<h:panelGroup id="foo" layout="block">
    <your:composite rendered="#{bean.loadCompositeInDiv}" />
</h:panelGroup>

<h:commandButton value="Load composite in div" action="#{bean.setLoadCompositeInDiv(true)}">
    <f:ajax render="foo" />
</h:commandButton>

@ManagedBean
@ViewScoped 
public class Bean {

    private boolean loadCompositeInDiv;

    // Getter+setter
}

【讨论】:

    猜你喜欢
    • 2011-03-06
    • 2012-07-15
    • 2011-11-09
    • 2013-02-02
    • 2011-10-14
    • 1970-01-01
    • 2012-06-08
    • 2018-06-18
    • 2011-05-30
    相关资源
    最近更新 更多