我有一个页面,其中显示了从web服务加载的对象列表。可能还要等一下。 现在我想用Ajax的方式做,并首先显示页面,然后加载列表。应该显示列表正在加载动画时。 任何人都可以给我一个例子如何用JSF/ICEFaces做到这一点?谢谢。使用IceFaces加载Ajax样式
1
A
回答
0
使用SessionRenderer会更好。查看我的ICEfaces书籍示例(http://icecube-on-icefusion.googlecode.com/),并搜索progressDialog标签作为示例。或书中的第244ff页。
0
好的,自己解决吧。
这里是我如何做它:
在Managed Bean的构造我打电话从而创建并启动一个新的线程的方法。该线程加载对象。只要对象在那里,我的bean的'加载'标志被设置为false,并且
PersistentFacesState.getInstance().renderLater();
被调用。 '加载'最初设置为false。
这对装载在异步模式中的对象的方法:
private void asyncLoading() {
final MyBackingBean bean = this;
final String userName = CallerContextUtil.getCurrentUserCompany();
new Thread() {
@Override
public void run() {
bean.setLoading(true);
PersistentFacesState.getInstance().renderLater();
load(userName);
bean.setLoading(false);
PersistentFacesState.getInstance().renderLater();
}
}.start();
}
在我展示或在装载标志的状态隐藏动画加载图像的图。
我不知道这是最好的还是最好的解决方案。欢迎评论。
0
强烈建议在J2EE服务器中创建新线程。管理线程是服务器的工作。
当你的页面被加载时,你可以要求提交一个使用ajax的icefaces表单,这应该可以做到。
0
我想我有答案这个问题,因为我对AJAX式装载同样的烦恼..
潜伏在许多网站和论坛ICEfaces的,我有这样的代码,而无需使用螺纹:
首先你要下载的jQuery,然后将代码是这样的:
<script type="text/javascript" src="js/jquery-1.6.min.js"/>
<script type="text/javascript">
var j = jQuery.noConflict();
j(document).ready(function(){
j(".wrapper-popup-loading").hide();
});
function icesubmitlocal() {
var windowWidth = document.documentElement.clientWidth;
var windowHeight = document.documentElement.clientHeight;
var popupHeight = j(".wrapper-popup-loading").height();
var popupWidth = j(".wrapper-popup-loading").width();
j(".wrapper-popup-loading").css({
"position": "absolute",
"top": windowHeight/2-popupHeight/2,
"left": windowWidth/2-popupWidth/2
}).show();
j(".wrapper-popup-white").show();
}
function icereceivelocal() {
j(".wrapper-popup-loading").hide();
j(".wrapper-popup-white").hide();
}
function init() {
Ice.onSendReceive('document:body',icesubmitlocal,icereceivelocal);
}
</script>
<body onload="init()" id="outputBody1" style="-rave-layout: grid">
的基本想法很简单,每一个AJAX调用,你只需要显示弹出股利,每一次你从ICEfaces的JS收到确认,你只需要隐藏流行音乐起来,
在弹出的面板是这样的:
<div class="wrapper-popup-loading"><!-- start wrapper -->
<div class="wrapper-popup-white"><!-- start wrapper -->
<center>
<img src="images/aed-popup.png" alt="" style="margin-top: 5px;"/>
<br />
<img src="images/aed-garuda.gif" alt="" style="margin-top: 5px;"/>
</center>
</div>
</div><!-- end footer -->
然后,每次阿贾克斯要求,您的弹出窗口显示,如果阿贾克斯停止,弹出式窗口是隐藏..
希望这有助于..感谢
相关问题
- 1. 位置和样式ajax加载程序
- 2. 加载ajax内容使用了哪些样式表?
- 3. Richfaces + Icefaces Ajax Push
- 4. 使用Ajax加载
- 5. 使用角度样式加载CSS
- 6. 使用YUI3动态加载样式表
- 7. 样式JSF ICEFaces王牌:对话
- 8. 预加载IFrame或使用Ajax加载
- 9. 使用AJAX加载网页
- 10. 使用Ajax延迟加载
- 11. 使用ajax加载内容
- 12. Jquery使用ajax加载url
- 13. 使用Ajax加载内容
- 14. 使用AJAX加载图像
- 15. jquery加载使用$ .ajax
- 16. 使用jQuery ajax加载的内容POST失去了瞬间的样式
- 17. 使用jquery在AJAX中加载AJAX
- 18. ICEFaces AJAX重定向到404
- 19. IE8不加载样式表
- 20. 无法加载样式表
- 21. Django样式表加载但不适用?
- 22. 样式表CSS没有用Context.RewritePath加载
- 23. 自举加载但不适用样式
- 24. 动态加载和卸载样式表
- 25. Ajax调用加载
- 26. 使用Ajax使用Twitter加载/卸载模式窗口引导程序
- 27. rel =预加载样式表不适用一次下载的样式
- 28. 加载内容和添加样式
- 29. ASP.NET - 使用AJAX加载用户控件?
- 30. 使用PHP静态文件加载器加载CSS样式时出现问题
PersistentFacesState有什么问题,什么使SessionRenderer更好?我的方法可以解决哪些问题?它似乎工作... – hugri 2010-02-13 20:18:57