JSF:部分来自AJAX调用添加文本组成部分组成部分、文本、部分、JSF

由网友(心中千万只草尼玛在咆哮)分享简介:我想inputTextarea显示附加一些文本文件中的行。我想它是这样的:用户单击一个命令,做一个AJAX调用I want a inputTextarea to display lines appended to some text file. I imagine it like this: The user cli...

我想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>.

阅读全文

相关推荐

最新文章