e ai…
Estou utilizando JSF no netbeans, preciso que uma pagina fique atualizando a cada 3 minutos, nao quero que o cliente fique clicando no botao do form.
sera q tem como ?
e ai…
Estou utilizando JSF no netbeans, preciso que uma pagina fique atualizando a cada 3 minutos, nao quero que o cliente fique clicando no botao do form.
sera q tem como ?
Bom, você pode utilizar o META com parametro refresh ou pode utilizar a tag do A4J poll.
[]´s
Daniel
o meta simula um refresh (f5), eu preciso que a cada 3 min. de um submit no form.
Então utilize o poll. Se você estiver utilizando richfaces é só chamar a tag a4j:poll. Com ela você pode determinar um período para que determinado componente seja executado.
[]´s
Daniel
yorgan, estou usando jsf no netbeans e nao encontrei A4J poll, provelmente pq nao estou utilizando RichFaces, entao baixei richfaces-ui-3.2.1.GA, coloquei no lib, mas nao estou conseguindo utilizar, poderia me explicar como confirula-lo ?
Sou novo em JSF entao estou bem perdido ainda.
value…
Você precisa alterar o seu web.xml e incluir o Richfaces.
Aqui tem um exemplo:
<?xml version="1.0"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<display-name>a4jEchoText</display-name>
<context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value>classic</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<filter>
<display-name>RichFaces Filter</display-name>
<filter-name>richfaces</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>richfaces</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>forward.jsp</welcome-file>
</welcome-file-list>
</web-app>
[]´s
Daniel
entao, configurei esses dados no xml e inclui esta linha no jsp xmlns:a4j=“https://ajax4jsf.dev.java.net/ajax”, a partir daqui apareceu a tag, mas qndo vou abrir a pagina ocorre um exception
Caused by: com.sun.rave.web.ui.appbase.ApplicationException: org.apache.jasper.JasperException: An exception occurred processing JSP page /Page2.jsp at line 10
7: <jsp:root version="2.1" xmlns:a4j="https://ajax4jsf.dev.java.net/ajax" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
8: xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:webuijsf="http://www.sun.com/webui/webuijsf">
9: <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
10: <a4j:poll action="#{Page2.btAtualizar_action}" reRender="tablePosicoes" interval="10000"/>
11: <f:view>
12: <webuijsf:page id="page1">
13: <webuijsf:html id="html1" lang="">
java.lang.ClassCastException: org.ajax4jsf.component.AjaxViewRoot cannot be cast to org.ajax4jsf.component.html.AjaxPoll
at org.ajax4jsf.taglib.html.jsp.AjaxPollTag.setProperties(AjaxPollTag.java:368)
at javax.faces.webapp.UIComponentClassicTagBase.findComponent(UIComponentClassicTagBase.java:604)
at javax.faces.webapp.UIComponentClassicTagBase.doStartTag(UIComponentClassicTagBase.java:1126)
at org.apache.jsp.Page2_jsp._jspx_meth_a4j_005fpoll_005f0(Page2_jsp.java:176)
at org.apache.jsp.Page2_jsp._jspService(Page2_jsp.java:144)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
opa…tente declarar assim as taglibs:
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
mesmo assim nao funcionou, estranho este problema de casting, parece conflito de jar’s.
Exception Details: java.lang.ClassCastException
org.ajax4jsf.component.AjaxViewRoot cannot be cast to org.ajax4jsf.component.html.AjaxPoll
Verifiquei se você baixou os 3 jar´s do projeto:
richfaces-api-3.3.0.GA.jar
richfaces-impl-3.3.0.GA.jar
richfaces-ui-3.3.0.GA.jar
estou com os 3 mas da versao 3.2.1
acho q esta havendo algum conflito com algum jar do jsf q o netbeans utiliza ou q esta no lib do tomcat.
yorgan oq vc acha ?
Pode ser.
Poste a lista de jars que está utilizando no projeto e a que deixou no tomcat.
Além disso poste o seu web.xml
[]´s
Daniel
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>My First JSF Application</display-name>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.verifyObjects</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<filter>
<filter-name>UploadFilter</filter-name>
<filter-class>com.sun.webui.jsf.util.UploadFilter</filter-class>
<init-param>
<description>The maximum allowed upload size in bytes. If this is set to a negative value, there is no maximum. The default value is 1000000.</description>
<param-name>maxSize</param-name>
<param-value>1000000</param-value>
</init-param>
<init-param>
<description>The size (in bytes) of an uploaded file which, if it is exceeded, will cause the file to be written directly to disk instead of stored in memory. Files smaller than or equal to this size will be stored in memory. The default value is 4096.</description>
<param-name>sizeThreshold</param-name>
<param-value>4096</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>UploadFilter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<filter>
<filter-name>MyFacesExtensionsFilter</filter-name>
<filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
</filter>
<!-- extension mapping for adding <script/>, <link/>, and other resource tags to JSF-pages -->
<filter-mapping>
<filter-name>MyFacesExtensionsFilter</filter-name>
<!-- servlet-name must match the name of your javax.faces.webapp.FacesServlet entry -->
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<!-- extension mapping for serving page-independent resources (javascript, stylesheets, images, etc.) -->
<filter-mapping>
<filter-name>MyFacesExtensionsFilter</filter-name>
<url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
</filter-mapping>
<filter>
<display-name>RichFaces Filter</display-name>
<filter-name>richfaces</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>richfaces</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<listener>
<description>Inicia o spring com a aplicacao</description>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<description>Permite o spring controlar as sessoes
e requisicoes dos beans declarados no
applicatonContext.xml
</description>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<init-param>
<param-name>javax.faces.LIFECYCLE_ID</param-name>
<param-value>com.sun.faces.lifecycle.PARTIAL</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>ExceptionHandlerServlet</servlet-name>
<servlet-class>com.sun.errorhandler.ExceptionHandler</servlet-class>
<init-param>
<param-name>errorHost</param-name>
<param-value>localhost</param-value>
</init-param>
<init-param>
<param-name>errorPort</param-name>
<param-value>24444</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>ThemeServlet</servlet-name>
<servlet-class>com.sun.webui.theme.ThemeServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ExceptionHandlerServlet</servlet-name>
<url-pattern>/error/ExceptionHandler</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ThemeServlet</servlet-name>
<url-pattern>/theme/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>forwardToJSF.jsp</welcome-file>
</welcome-file-list>
<error-page>
<exception-type>javax.servlet.ServletException</exception-type>
<location>/error/ExceptionHandler</location>
</error-page>
<error-page>
<exception-type>java.io.IOException</exception-type>
<location>/error/ExceptionHandler</location>
</error-page>
<error-page>
<exception-type>javax.faces.FacesException</exception-type>
<location>/error/ExceptionHandler</location>
</error-page>
<error-page>
<exception-type>com.sun.rave.web.ui.appbase.ApplicationException</exception-type>
<location>/error/ExceptionHandler</location>
</error-page>
<jsp-config>
<jsp-property-group>
<url-pattern>*.jspf</url-pattern>
<is-xml>true</is-xml>
</jsp-property-group>
</jsp-config>
</web-app>
libs do projeto
appbase.jar
cglib-2.2.jar
commons-beanutils.jar
commons-collections-3.1.jar
commons-dbcp-1.2.2.jar
commons-digester-1.7.jar
commons-fileupload-1.1.jar
commons-lang-2.3.jar
commons-logging-api.jar
commons-logging.jar
commons-pool-1.3.jar
commons-validator-1.2.0.jar
dataprovider.jar
errorhandler.jar
jsf-api.jar
jsf-extensions-common-0.1.jar
jsf-extensions-dynamic-faces-0.1.jar
jsf-impl.jar
jsfcl.jar
json-2.jar
jstl.jar
postgresql-8.2-509.jdbc4.jar
richfaces-api-3.2.1.GA.jar
richfaces-impl-3.2.1.GA.jar
richfaces-ui-3.2.1.GA.jar
spring-2.5.jar
sqlx.jar
standard.jar
tomahawk12-1.1.8.jar
webui-jsf-suntheme.jar
webui-jsf.jar