English 中文(简体)
JSF 2.0 Part Making on page on documentload
原标题:JSF 2.0 partial rendering on page on document load
  • 时间:2012-01-14 00:40:09
  •  标签:
  • java
  • jsf-2

I have a page, one section of which I want to load only after the whole page is loaded. For this, I m using the following code on the page:

<script type="text/javascript">
    alert("In the JS");
    $(document).ready(
        function() {
            $.post(jspPath+ /myCommunity/ajax/hotTopicDiscussion.faces , 
                function(data) {
                    jsf.ajax.request(this,  post , {render:  discussionTopic });
                }
            );  
        }
    );
</script>

并且

<h:panelGroup id="discussionTopic" reRendered="#{discussionBean.doRender}">

这一编号为doRender/code>,是一俟美国宇宙航空研究开发机构发出呼吁即予确定的财产。 但这不是装上数据。 我可以看到,麻风病方法正在被称作。

问题回答

看来,你对<代码>jsf.ajax.request的呼吁是不正确的。 http://docs.oracle.com/cd/E17802_01/j2ee/javaee/javaserverfaces/2.0/docs/js-api/symbols/jsf.ajax.html#request”rel=“nofollow” JsDoc reference关于/code>的论点如下:

source: The DOM element that triggered this Ajax request, or an id string of the element to use as the triggering element.

event: The DOM event that triggered this Ajax request. The event argument is optional.

options: The set of available options that can be sent as request parameters to control client and/or server side request processing.

因此,第一要素必须是形式内的某些内容,或者可能是形式本身。 您可尝试通过表格或内容本身来履行这一职能。

really是否需要提交一种麻醉的表格? The s where the jsf.ajax.request(). 似乎你只是想在<条码>和div>内装载一些固定内容。 理由如下:

<script>
    $(document).ready(function() {
        $.get("#{request.contextPath}/myCommunity/ajax/hotTopicDiscussion.faces", function(data) {
            $("#discussionTopic").html(data);
        });
    });
</script>
<h:panelGroup id="discussionTopic" layout="block" />

Or, simpler, with jQuery.load():

<script>
    $(document).ready(function() {
        $("#discussionTopic").load("#{request.contextPath}/myCommunity/ajax/hotTopicDiscussion.faces");
    });
</script>
<h:panelGroup id="discussionTopic" layout="block" />

在这两种情况下,我假定,<代码>热分辨率-------------><> 代码>有<代码><ui:composition>作为根本内容,它只包含必要的超文本(因此没有<代码><html>等)。

如果你真的真的需要提交一种麻醉形式的表格,那么最简单的做法是让联合材料“click”按方案分类。 它将把一切方式下放到适当和必要的<代码>jsf.ajax.request()。 电话:jsf.ajax.request()在网页上没有物理形式/布特顿成分的情况下是无用的。 如果有必要,你可以隐藏安全局的形式。

<script>
    $(document).ready(function() {
        $("[id= form:button ]")[0].onclick();
    });
</script>
<h:form id="form" style="display:none;">
    <h:commandButton id="button" action="#{bean.submit}">
        <f:ajax render=":discussionTopic" />
    </h:commandButton>
</h:form>
<h:panelGroup id="discussionTopic" layout="block" />




相关问题
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 ...

热门标签