Tag Archives: JSF

Simple CRUD with JSF and Hibernate

via Simple CRUD with JSF and Hibernate | Geek On Java – Hub for Java and Android.

This example shows how to develop a simple CRUD (Create Read Update Delete) by using JSF2, Hibernate and MySQL.
This application lets you manage customer database such as add new customer and update/delete customer info.

Session Timeout Handling on JSF AJAX request

via Programming Peacefully: Session Timeout Handling on JSF AJAX request.

When we develop JSF application with AJAX behaviour, we may experience the problem in handling timeout scenario of Ajax request. For example, if you are using J2EE Form-based authentication, a normal request should be redirected to the login page after session timeout. However, if your request is AJAX, the response could not be treated properly on the client-side. User will remain on the same page and does not aware that the session is expired.

Many people proposed solution for this issue. The followings are two of possible solutions involve the use of Spring security framework:
1. Oleg Varaksin’s post
2. Spring Security 3 and ICEfaces 3 Tutorial

Utilizing the Java 8 Date-Time API with JSF and Java EE 7

via Josh’s Dev Blog – Java, Java EE, Jython, Oracle, and More…: Utilizing the Java 8 Date-Time API with JSF and Java EE 7.

If you are using Java 8 with Java EE 7, then there may be some quirks that you run into when trying to utilize some of the Java 8 new features.  One such quirk is that the new Date-Time API does not work with many of the Java EE 7 APIs by default since they are built to work with java.util.Date and/or the older Date APIs.  However, this is not a road block, as there are many ways to work around such issues.  In this post, I will demonstrate how you can tweak your JSF application to allow use of the Java 8 Date-Time APIs along with JPA and date converters.

JSF 2.0 Tree Example

via JSF 2.0 Tree Example | Examples Java Code Geeks.

Hi there! Today we ‘re gonna talk about trees’ implementation, according to JSF 2.0. We all know that JSF is here to ease the server-side user interfaces development, but when it comes to trees, things are getting somehow complicated: JSF does not have a default tree component, so we have to “extend” the framework’s functionality/implementation, by combining it with a framework that supports tree visualization. Relative frameworks that support tree visualization are PrimeFaces, RichFaces and IceFaces.

We ‘ll go for PrimeFaces, due to the following pros:

  • Easy to use.
  • Practical documentation.
  • Developers’ trend.
  • The fastest library.

What today’s example examines is a simple tree view with three nodes attached (we ‘ll refer to its children details in a next section).

JSF Components Listeners Example

via JSF Components Listeners Example | Examples Java Code Geeks.

In this example of JSF Components Listeners, we will discuss about various component listeners provided by Java Server Faces and show you different ways of using the listeners.

In a web page when the user makes changes to the input component or performs an action on the UI component, the JSF fires an event. These events can be handled by application to take necessary action. JSF provides listeners to capture the event. We can implement the listeners as classes or use the backing bean method to capture the event. Depending upon how the listener is implemented, the page can either use listener tag or listener attribute of the UI component. We will show you both the approaches here. Let’s begin with setting up a JSF project and do all the necessary configuration to run the application.

Our preferred environment is Eclipse. We are using Eclipse Luna SR1 with Maven Integration Plugin, JDK 8u25 (1.8.0_25) and Tomcat 8 application server. Having said that, we have tested the code against JDK 1.7 and Tomcat 7 as well.

Did AngularJS Borrow Some Concepts from JSF?

via Did AngularJS Borrow Some Concepts from JSF? | Max Katz.

Since Appery.io added support for Bootstrap and AngularJS, I have been using these frameworks a lot. Many years ago I have been using and teaching JSF and RichFacesframeworks. Surprisingly (or not), I see some concept similarities between AnguarJS and JSF. Obviously AngularJS and JSF are very different frameworks, but they do share some concepts. Let’s look at a simple example.

JSF: Validation at the right phase (understanding the life cycle)

via JSF: Validation at the right phase (understanding the life cycle) | Java Code Geeks.

In general, understanding the so called JSF Life Cycle is what sets apart junior developers, who mostly copy and paste everything they see in front of them, and the senior ones who are able to “wing it” when facing uncommon scenarios without compromising code quality.

Usually when I’m interviewing somebody who claims to have years of experience with JSF and seems to have no knowledge of the life cycle, I take it as a bad sign 🙂