java - How to implement a loading page in JSF 2.2 -


i want implement loading page gmail in jsf web application.

  1. user enters login , password take him simple page progress bar (loading application page).
  2. once progress bar hits 100% application page shown.

(hits 100% means gets progress value according progress of initialization of application page).

now, need implement this, backing beans scopes, number of facelets, faces-config..

additional info :

  • i'm using primefaces 4.0
  • i'm using webfilter :

    @webfilter(filtername = "authfilter", urlpatterns = {"*.xhtml"}) redirect not connecetd user login page.

enter image description here


this i've tried far no luck (the application stops in loading page).

login.xhtml backing bean userbean(session scoped).

userbean.dologin()  ==> return "loaderpage"; 

loaderpage.xhtml no backing bean

<h:body>     <p:progressbar widgetvar="pbajax" ajax="true"                    value="#{dyna.progress}"                    labeltemplate="{value}%"                    styleclass="animated">           <p:ajax event="complete" listener="#{userbean.oncomplete}" />       </p:progressbar>   </h:body> 

dyna.progress <==this located on application page backing bean (session scoped)

this how set value on progress bar of loadingpage.xhtml

@managedbean(name = "dyna", eager = true) @sessionscoped @postconstruct public void init() {     try {         progress = 0;         etatdateoptions = listsmaker.getdatefilters();         progress = 10;         optionspatstate = listsmaker.getpatientstates();         progress = 20;         optionscotpatstate = listsmaker.getpayementstates();         progress = 30;          ...} 

this faces-config

<faces-config version="2.2"           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-facesconfig_2_2.xsd">  <navigation-rule>     <from-view-id>/loader.xhtml</from-view-id>     <navigation-case>         <from-action>#{userbean.oncomplete}</from-action>         <to-view-id>/appplace.xhtml</to-view-id>     </navigation-case> </navigation-rule>  <navigation-rule>     <from-view-id>/appplace.xhtml</from-view-id>     <navigation-case>         <from-action>#{dyna.killview}</from-action>         <from-outcome>success</from-outcome>           <to-view-id>/login.xhtml</to-view-id>            <redirect>                 </redirect>        </navigation-case>    </navigation-rule> 

have @ solution primefaces provides, namely progressbar. in case not make init() method @postconstruct, call init() method once client forwarded loaderpage.xhtml. there on can call getprogress().


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -