Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf Primefaces轮询组件触发HTTP选项,并且未进行Ajax调用_Jsf_Jsf 2_Primefaces - Fatal编程技术网

Jsf Primefaces轮询组件触发HTTP选项,并且未进行Ajax调用

Jsf Primefaces轮询组件触发HTTP选项,并且未进行Ajax调用,jsf,jsf-2,primefaces,Jsf,Jsf 2,Primefaces,我正在写一个网页应用程序,网页需要每秒钟刷新一次。我决定使用Primefaces Poll组件定期进行ajax调用 但是,不会对项目基础url进行调用,例如: http://localhost:8080 但当url描述文件夹结构时,它确实可以正常工作: http://localhost:8080/web/index.xhtml 项目结构: <welcome-file-list> <welcome-file>/web/index.xhtml</welcom

我正在写一个网页应用程序,网页需要每秒钟刷新一次。我决定使用
Primefaces Poll
组件定期进行ajax调用

但是,不会对项目基础url进行调用,例如:

http://localhost:8080
但当url描述文件夹结构时,它确实可以正常工作:

http://localhost:8080/web/index.xhtml
项目结构:

<welcome-file-list>
    <welcome-file>/web/index.xhtml</welcome-file>
</welcome-file-list>

web.xml中的欢迎文件:

<welcome-file-list>
    <welcome-file>/web/index.xhtml</welcome-file>
</welcome-file-list>
FireBug中的进一步调试表明,实际上有一个HTTP OPTIONS方法,名为:

但它甚至没有被调用到
http://localhost:8080/web/index.xhtml
但是要
http://web/index.xhtml
过了一段时间后就会中止



我可以通过强制重定向到地址
http://localhost:8080/web/index.xhtml
但我真的很想知道是什么导致了这个问题,并更清楚地解决它。

您正在设置一个绝对路径作为欢迎文件,值中的第一个
/
指出了这一点:

/web/index.xhtml
删除它,使其相对于应用程序的上下文路径:

web/index.xhtml

我认为
/web/index.xhtml
不需要第一个
/
@LuiggiMendoza哇!请写下来作为回答,它确实解决了问题。现在我知道问题出在哪里了。请注意,这仍然不是使用
的正确方法:
@Component("counterView")
@Scope("session")
public class CounterView {

    private int number;

    public int getNumber() {
        return number;
    }

    public void increment() {
        number++;
    }

}