some comparison on JSF and GWT

GWT and JSF are very different technologies and one of the major differencies is in server state : in GWT is generally none and in JSF full. That means that JSF in one request/response perform on server component tree build and this build takes some time. GWT normally holds complete state in client (in compiled…

Primefaces push and poll

Poll componentmake ajax calls in a specified interval.There was a memory leak issue before version 3.4. Now it should be fine. PrimePush is built on top of Atmosphere Framework. We can push message or data to multiple subscriber.

enable / disable a JSF Command Button

primeface page goes like this,  <p:commandButton update=”panel1″  actionListener=”#{bean.button1}” value=”button1″ disabled=”#{bean.disable}”>      <f:setPropertyActionListener value=”#{false}” target=”#{bean.disable}”/>    </p:commandButton>  <p:commandButton update=”panel2″  actionListener=”#{bean.button2}” value=”button1″ disabled=”#{!(bean.disable)}”>      <f:setPropertyActionListener value=”#{true}” target=”#{bean.disable}”/>      </p:commandButton> Manage Bean:  public class Bean {     private boolean disable;     // default constructor     public Bean(){        this.disable= false;…

Persist and pass FacesMessages over multiple page redirects

Very Simple In a JSF Reference Implementation, passing global faces messages between pages doesn’t work. It’s not designed that way “out of the box.” Fortunately there is a way to do this, which will even support redirects between pages, forwards through a RequestDispatcher, and also through standard JSF navigation cases. There is a 5 minute…

p:commandButton needs two clicks to fire action primefaces

I need to click my button twice to fire an action. There seems to be a depency on the navigation of the site that’s calling this page. If the previous navigation is done by a <p:button outcome=”next_page”> the button on “next_page” reacts on the first click. Using <p:commandButton action=”next_page”> i need two clicks on “next_pages”‘s…

JSF 2.0: actionListener action in primefaces with setPropertyActionListener

Today I had a problem with a PrimeFaces-CommandButton which has a setPropertyActionListener and an actionListener attached to it. The problem was that the actionListener is called before the setPropertyActionListener, which resulted in the behavior that the Method could only access the set property the second time it got executed. Replacing the actionListener with an action…

primemobile view navigate data not updated

if you have 2 view in a xhtml, 1st view do the calculation and 2nd view display the result of the calculation. Then the 2nd view would not updated because the page is pre-generated . For now I have to use two different page for this, have not found a way using “update” for another…

datatable row selected unselected in primefaces

<p:dataTable id=”menusTable” var=”menu” value=”#{menuManager.resultMenus}” rowKey=”#{menu.name}” paginator=”true” rowClasses=”odd, even” rows=”5″ rowsPerPageTemplate=”5, 10, 15, 25, 50, 100″ paginatorTemplate=” {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown} ” sortBy=”#{menu.name}” selection=”#{menuManager.selectedMenu}” selectionMode=”single”> <p:ajax event=”rowSelect” listener=”#{menuManager.onRowSelect}”/>   if we have the selection mapped to a field in the service bean like the red part above, the datatable would always remember our last…

hack css in primefaces

Create a style sheet file: /resources/css/default.css You need to ensure that you load the stylesheet by <h:outputStylesheet> the usual way. This will ensure that the stylesheet is loaded after the PrimeFaces’ default styles. <h:head>     <h:outputStylesheet name=”css/default.css” /> </h:head> You also need to ensure that your CSS selector is at least as specific as the PrimeFaces’ default CSS selector on…

create ajax State-City of U.S selection in Primefaces

Steps: get all state, city info of U.S from HERE . There are also many other data could be freely download from this site. dump the dbf file to sql. create tables in mysql and import all data create UI and backing beans for the data. UI: <h:outputLabel for=”state” value=”state: *” /> <p:selectOneMenu id=”state” value=”#{userManager.potentialUser.state}”> <f:selectItem itemLabel=”Select…

PrimeFaces p:commandButton doesn’t navigate

The <p:commandButton id=”btn” value=”Register” ajax=”false” update=”panel” action=”#{userManager.createUser}” /> It does not navigate even I explicitly use return “menus?faces-redirect=true”; in the createUser method.   If I changed the p:commandButton to h:commandButton, it would work.   A better solution would be delete the update=”panel” part so that the UI part would feedback.

primeface change theme

download theme from t PrimeFaces repository add to build path in web.xml add parameter <context-param>     <param-name>primefaces.THEME</param-name>     <param-value>THEMENAME</param-value> </context-param> refresh 🙂