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…

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…

Struts2 or JSF2

Struts 2 is an Action Framework whereas JSF is a Component Framework. An Action Framework is intimately tied to the HTTP request cycle and request format. A Component Framework tends to hide the underly HTTP request and use its own, higher level abstraction. Action Frameworks tend to work better in stateless environments, Component Framework typically…

jsp jsf xhtml faces url-pattern

JSP is an old view technology and widely used in combination with JSF 1.x. Facelets (XHTML) is the successor of JSP and introduced as default view technology of JSF 2.x at end of 2009. When you were seeing JSPs, you were perhaps reading old/outdated books/tutorials/resources targeted on JSF 1.x. You should generally ignore them when…

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 🙂

eclipse project前面红色感叹号

如果删除了某个build path里的jar的源文件而没有在build path里面删除,工程前面就会出现红色感叹号。后果是很严重的,连更新的java文件都不会编译更新。悲催……   PS: primefaces中datatable接受类型只能是List不能是Set。所以在ORM的时候用List比Set保险!