Jsf primefaces轮询标记不起作用
我正在使用primefaces库这是我的jsp页面源代码:Jsf primefaces轮询标记不起作用,jsf,tags,primefaces,Jsf,Tags,Primefaces,我正在使用primefaces库这是我的jsp页面源代码: <%@taglib uri="http://primefaces.prime.com.tr/ui" prefix="p"%> <%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%> <%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%> <% String path = req
<%@taglib uri="http://primefaces.prime.com.tr/ui" prefix="p"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<f:view>
<head>
<p:resources />
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
</head>
<body>
<h:form>
<h:outputText id="txt_count" value="#{counterBean.count}" />
<p:poll actionListener="#{counterBean.increment}" update="txt_count" />
</h:form>
</body>
</f:view>
</html>
我的web.xml如下
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Resource Servlet</servlet-name>
<servlet-class>org.primefaces.resource.ResourceServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Resource Servlet</servlet-name>
<url-pattern>/primefaces_resource/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>test.jsp</welcome-file>
</welcome-file-list>
</web-app>
Facesservlet
javax.faces.webapp.FacesServlet
0
Facesservlet
*.面孔
资源Servlet
org.primefaces.resource.ResourceServlet
资源Servlet
/素数资源/*
test.jsp
我的页面加载正确,但没有定期更新
当它被加载时,它说“雅虎没有定义”,所以它不工作
我已经定义了资源servlet,但它还不能工作
请帮帮我 显然,您正在JSF2.0上使用PrimeFaces2.0。在JSF2.0中,
p:resources
已被弃用。您应该使用Facelets而不是JSP。如果一切正常,您应该在服务器日志中看到以下条目:
INFO: p:resources component is deprecated and has no use in PrimeFaces 2.0 as
JSF 2.0 resource apis are used instead to place resources on page.
在阅读JSF书籍/教程时,请确保您阅读的是JSF2.0,而不是1.x
INFO: p:resources component is deprecated and has no use in PrimeFaces 2.0 as
JSF 2.0 resource apis are used instead to place resources on page.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui">
<h:head>
<title>My Facelets 'index.xhtml' starting page</title>
<base href="//#{request.serverName}:#{request.serverPort}#{request.contextPath}"></base>
</h:head>
<h:body>
<h:form>
<h:outputText id="txt_count" value="#{counterBean.count}" />
<p:poll actionListener="#{counterBean.increment}" update="txt_count" />
</h:form>
</h:body>
</html>