English 中文(简体)
F 2.0: Delaying (composite) part s contents until AJAX-call re-renders it
原标题:JSF 2.0: Delay rendering (composite) component s contents until AJAX-call re-renders it

我的目标是动态地装载2.0号共同基金组成部分的内容。 使用案例是:用户点击了一些纽特州,该州通过日本宇宙航空研究开发机构与一些重参与者开设了一个模式小组。 由于自身行为,我想推迟装货,直到用户实际需要。 如果用户关闭这个小组,它实际上就没有从人力部移走,只是 f。 如果用户再次点击初始化纽顿,则显示以前装满的小组。

我知道,我可以防止使用<代码>rendered=”#{cc.attrs.visibilityState = = 隐蔽的}”

(1) 我知道我可以做:

<h:outputLink>Foo
    <f:ajax event="click" render="theComponentIWantToUpdate" listener="#{someBean.someMethod()}" />
</h:outputLink>

之后,在方案上调整了<代码>ComponentIWant ToUpdate属性(改为#{cc.attrs.visibility State}) 这样,它实际上就能够提供全部内容。 但是,如何实际做到这一点?

2) 另外,问题是,我不想更新(再提交)<编码>。 每当纽顿受到压力时,只有第一次(见商业案例)。 我如何对<代码>和“t”进行评价;f:ajax />。 呼吁这样做? 它有<条码>可拆解的属性,但只是命令它是否实际上使AJAX-handler(在发出链接时没有评估)。

3) 此外,我很可能首先在把该链接点点击时做一些习俗 j,而只是使用<代码>jsf.ajax.request()通过javascript执行AJAX的请求。 然而,这一功能并没有提供<代码>listener的证明,因此,我没有说明如何用原始javascriptjsf.ajax.request(et? 确实存在一个没有适当答案的类似问题(见)。 JSF 2.0 AJAX: jsf.ajax.request to calls methods not only rerender an area of page .

最佳回答

部分解决办法:

这里,我的联系是发出AJAX-request(综合部分):

<h:form>
    <h:outputLink styleClass="modlet-icon">
        <f:ajax event="click" render=":#{cc.clientId}:modalWindow:root" listener="#{modalWindowBean.enableContentRendering(cc.clientId,  modalWindow )}" />
    </h:outputLink>
</h:form>

听众呼吁采用这种方法:

public class ModalWindowBean {
    ...

    public void enableContentRendering(String clientId, String windowId) {
        UIComponent component = FacesContext.getCurrentInstance().getViewRoot().findComponent(clientId + ":" + windowId);
        component.getAttributes().put("contentRenderingEnabled", true);
    }
}

我的目标是:

<modalWindow:modalWindow id="modalWindow">
    <quickMenu:quickMenuOverlay id="quickMenuOverlay" />
</modalWindow:modalWindow>

ModalWindow简单地把目标归结为一个冰洞的窗口小组。 在ModalWindow:

<composite:implementation>
    <h:outputScript library="component/modalWindow" name="modalWindow.js" target="head" />
    <h:outputStylesheet library="component/modalWindow" name="ModalWindow.css" />

    <h:panelGroup id="root" layout="block" styleClass="modalWindow hide">
        <ui:fragment rendered="#{cc.attrs.contentRenderingEnabled}">
            ...all the wrapping elements with <composite:insertChildren /> within it
            <script type="text/javascript">
                // Fade it in
                var win = ModalWindow.getInstance( #{cc.clientId} );  // this gets the instance, available everywhere
                win.position(#{cc.attrs.left}, #{cc.attrs.top});
                win.resize(#{cc.attrs.width}, #{cc.attrs.height});
                win.fadeIn();
            </script>
        </ui:fragment>
    </h:panelGroup>

    <ui:fragment rendered="#{!cc.attrs.contentRenderingEnabled}">
        <script type="text/javascript">
            // Initialize modalWindow when it is rendered for the first time
            var win = new ModalWindow( #{cc.clientId} );  // will be publicly available through ModalWindow static methods
        </script>
    </ui:fragment>

</composite:implementation>

问题? 每次用户点击纽顿时,都会发出AJAX-request(因此窗户每时都重载和重置)。 如果真的发出AJAX-request,我需要能够控制。

所有这些都使我错失了Patricia Wicket,尽管我不敢肯定我会怎样这样做:

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签