简体   繁体   English

JSF / Richfaces Ajax 请求

[英]JSF / Richfaces Ajax Requests

In a Tabpanel each Tab's content is fetched from the server by ajax (using the switchType="ajax" attribute) so that all the content does not have to be fetched at the start.在 Tabpanel 中,每个 Tab 的内容都由 ajax(使用switchType="ajax"属性)从服务器获取,因此不必在开始时获取所有内容。 After the content is fetched once, though, it should not be fetched from the server again since the content is already present on the page.但是,在获取一次内容后,不应再次从服务器获取内容,因为该内容已存在于页面上。 The content of the Tab should should just be toggled between display:none and display:block as it would be if the switchType were set to client Tab 的内容应该在display:nonedisplay:block之间切换,就像将switchType设置为client

Is there a way to tell JSF/Richfaces not to send the second ajax request if the content has already been fetched and instead just toggle the visibility?如果内容已经被获取,有没有办法告诉 JSF/Richfaces 不要发送第二个 ajax 请求,而只是切换可见性?

Asked onther way: is it possible to use the switchType="ajax" on the first request and switchType="client" for the following requests?以另一种方式询问:是否可以在第一个请求中使用switchType="ajax"并为以下请求使用switchType="client"

You'll have to keep a flag for every tab that decides the switchType, eg您必须为决定 switchType 的每个选项卡保留一个标志,例如

<rich:tab header="tab1" action="#{bean.switchTab(0)}" 
    switchType="#{bean.tabList[0] ? 'client' : 'ajax'}">Content</rich:tab>

You'll start with switchType="ajax" but when you load the tab it will be rerendered with switchType="client" .您将从switchType="ajax"开始,但是当您加载选项卡时,它将使用switchType="client"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM