JSF 2 AJAX-重新加载整个div(例如< ui:include src ="toReloadData.xhtml"/>) [英] JSF 2 AJAX - reload whole div (e.g. <ui:include src="toReloadData.xhtml" />)

查看:127
本文介绍了JSF 2 AJAX-重新加载整个div(例如< ui:include src ="toReloadData.xhtml"/>)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jsf2,并且想使用它的ajax功能.问题:我已经看过一些Ajax刷新的东西.但是没有什么可以刷新整个div的...

I'm working with jsf2 and want to use the ajax-functionality of it. Problem: I've already seen some ajax refresh things. But nothing to refresh a whole div...

我有一个xhtml页面,其中包含来自我的bean的数据,我真的不想刷新它的所有字段,刷新整个ui:include ...

I have a xhtml page with data from my bean, and i don't really want to refresh all fields of it, it would be easier to refresh the whole ui:include...

有人知道解决方案吗?还是我必须手动刷新所有字段?

does anybody knows a solution? Or do I have to refresh all fields manually?

最诚挚的问候

推荐答案

只需将它们放入具有ID的某个容器组件中,并在f:ajaxrender属性中使用它即可.

Just put them in some container component with an ID and use it in render attribute of f:ajax.

<h:form>
    <h:commandButton value="submit" action="#{bean.submit}">
        <f:ajax render=":foo" />
    </h:commandButton>
</h:form>
<h:panelGroup id="foo" layout="block">
    <ui:include src="include.xhtml" />
</h:panelGroup>

请注意,<h:panelGroup layout="block">呈现<div>.如果省略layout属性,则默认为<span>(仅当有任何需要呈现为HTML的属性(例如id)时).

Note that <h:panelGroup layout="block"> renders a <div>. If you omit the layout attribute, it defaults to <span> (only whenever there are any attributes which needs to be rendered to HTML, like id).

这篇关于JSF 2 AJAX-重新加载整个div(例如&lt; ui:include src ="toReloadData.xhtml"/&gt;)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆