110 likes | 223 Views
Tony Nguyen. Intro to J avaserver Faces. Architecture Advantages Disadvantages Setup JSF Environment JSF & Database Conclusion Demo. Architecture. A standard API for creating Java Web Application GUIs.
E N D
Tony Nguyen Intro to Javaserver Faces
Architecture • Advantages • Disadvantages • Setup JSF Environment • JSF & Database • Conclusion • Demo
Architecture • A standard API for creating Java Web Application GUIs. • Allow Java programmers to develop application without HTTP details and integrate it with user interface through event-driven model. • JSF based on Model-View-Controller (MVC) design pattern. • Drag and drop UI components to build web application. (EIS)
Advantages • Less code. • Custom GUI controls. • Form validation. • Event handling. • Managed beans. • Expression Language.
Disadvantages • Less transparent. • Harder to learn. • Not enough documentation. • Rigid approach. • Undeveloped tool support.
JSF & Event Driven • <h:form> • <!-- For non graphical browsers --> • <p>Example of <code>commandLink</code></p> • <h:panelGrid id="links" columns="4" • summary="#{bundle.chooseLocale}" • title="#{bundle.chooseLocale}" > • <h:commandLink id="NAmerica" action="storeFront" • actionListener="#{carstore.chooseLocaleFromLink}"> • <h:outputText value="#{bundle.english}" /> • </h:commandLink> • </h:panelGrid> • </h:form>
Expression Language <c:if test=“${result.rowCount == 0}”> Sorry, no products match your criteria </c:if> <c:if test=“${result.rowCount != 0}”> These products were found <ul> <c:forEach items=“${result.rows}” var=“row”> <li>${row.prodName}</li> </c:forEach> </ul> </c:if>
Setup JSF Environment • Java 2 Software Development Kit. • Enabled web-server Tomcat 5. • JSF 1.0 implementation(Sun’s Reference Implementation).
JSF & Database • Standard JDBC • JSTL • Hibernate
Conclusion • JSF can provide many useful features for developing complex GUIs and handling events. • MVC for web development. • Huge industry and vendor support.
References • http://myfaces.apache.org/download.html • http://www.oracle.com/technology/products/jdev/collateral/4gl/papers/JSF_For_4gl.pdf • http://www.roseindia.net/jsf/whatisjsf.shtml • http://jlbtc.eduunix.cn/index/html/java/OReilly.Java.Enterprise.in.a.Nutshell.3rd.Edition.Nov.2005/0596101422/javaentnut3-CHP-5-SECT-3.html • http://www.codeguru.com/cpp/data/mfc_database/sqlserver/article.php/c10079/#more • http://www.geekinterview.com/question_details/36717