Thursday, 24 June 2010

JSF 2.0 My First Look

Heard enough about JSF 2.0 to look into it today. Step 1was to find an IDE which supported it but unfortunately JDeveloper 11g didn't, so for the first time in a long time I had to move into another IDE and NetBeans IDE seemed the way to go here.

Although I just created some very basic demos it didn't take long to get into building tables from collections and other more useful demos. Few things really impressed me about JSF 2.0.

1. Finally I can add references to my model attributes as follows without the need to use a h:outputText component


2. You can simply use a default bean name for backing beans without the need to declare beans with managed-bean in faces-config.xml. You simple put @ManagedBean above the class definition.

public class CalculatorManagedBean implements Serializable {
public static char[] operands = { '+', '-', '*', '/' };

3. The use of Facelets, not JSP, as the standard technology for all your JSF pages. So you name your page pas.xhtml and can reference it as pas.jsf as long as your web.xml contains the following.

<servlet-name>Faces Servlet</servlet-name>
<servlet-name>Faces Servlet</servlet-name>

4. No real need to define explicit navigation rules. If your bean methods return a a string as follows then the resulting page pas.xhtml will be called.

return "pas";

Hope to spend more time on JSF 2.0 and of course there is more to it then just this but thats a good enough start for me.


Anonymous said...
This comment has been removed by a blog administrator.
Anonymous said...

Hey - I am certainly happy to find this. Good job!

Anonymous said...

Hi - I am definitely happy to find this. cool job!