JSF:部分来自AJAX调用添加文本组成部分 [英] JSF: Partially adding text to component from AJAX call

查看:126
本文介绍了JSF:部分来自AJAX调用添加文本组成部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想inputTextarea显示附加一些文本文件中的行。我想它是这样的:用户单击一个命令,做一个AJAX调用

I want a inputTextarea to display lines appended to some text file. I imagine it like this: The user clicks a commandButton that does a AJAX call.

我的问题是:文本将只在操作返回呈现。不过,我的行动应该是这样的:

My problem is: The text will only be rendered when the action returns. However, my action should look like this:

while(true) {
  String newData = getSomeMoreDataFromServer();
  // append the new data to a textarea and the user should see it immediately
  if(blabla) { break; } 
}

这甚至可能吗?多数民众赞成注释掉的部分是困扰我的部分。

Is this even possible? The part that's commented out is the part that bothers me.

可以在用户甚至设置断点条件的形式以某种方式?

Can the user even set the break condition in the form somehow?

我使用的是JSF 2(MyFaces的)+战斧。

I'm using JSF 2 (MyFaces) + Tomahawk.

推荐答案

这是不可能从支持bean的操作方法中。另外有一个,而(真)是非常CPU的效率不高,你宁愿要避免在多用户环境。你在寻找什么是AJAX轮询/推。此不提供在标准JSF实现,也不会在战斧。 PrimeFaces 例如,支持AJAX轮询/推组件的 <电话号码:调查> 和的 <号码:推>

That's not possible from inside the backing bean action method. Also having a while(true) is very CPU-inefficient, you'd rather like to avoid that in a multi-user environment. What you're looking for is ajax poll/push. This is not provided in the standard JSF implementation and also not in Tomahawk. PrimeFaces for example, supports ajax poll/push components <p:poll> and <p:push>.

这篇关于JSF:部分来自AJAX调用添加文本组成部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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