elstar IT

Fullstack | Java | Tech Speaker | Tech Coach | Frank van der Linden

  • About me
  • Blog license
  • My Open source projects

My steps in the JSF 2.0 world

24-10-2014 no responses flinden68 development

The last 2 weeks were very interesting, starting at a new customer as a Java developer on a JSF2.0 project.

XPages are based on highly customised version of JSF 1.1 at the base.

 

Annotations

The big advantage if JSF 2.0 is build in of Annotations. Very useful, like the @Formulas back, in my case, in the old days of Lotus Notes development.

For Managed Bean you can still use the faces-config.xml to control them. But now there is also the @ManagedBean(name=”fooBean”), you can use directly in the Java Class in combination with Scope Annotation, @ViewScoped, @RequestScope or @ApplicationScope.

Keep in mind that if you register also the Managed Bean in the faces-config.xml, this registration will overrule the @ManagedBean annotation on the Class.

Related to @ManagedBean, there is also @ManagedProperty annotation. Which can be used to directly include a Managed Bean inside the Java class. @ManagedProperty has one required parameter, ‘value’, which refer to the Managed Bean name. Inside the Java class you can automatically use the Managed Property.

Spring Framework uses the @Inject annotation to inject objects inside the Java class

 

Another very useful Annotation is @PostConstruct above a method inside a Java class, as the name suggest it will run as the Managed Bean will be instantiated. There is no need to trigger such a method from within a XPages or some other way.

 

Expression Language 

It is still there and as in XPages very powerful, but in JSF2.0 you not can call getters and setters in a bean, like #{bean.property1}, but also methods, like #{bean.method(argument)}

 

ProjectStage

In JSF 2.0, in perception, there is new thing, ProjectStage. In the web.xml you can put a tag to specify the current ProjectStage.

[dropshadowbox align=”none” effect=”lifted-both” width=”400px” height=”” background_color=”#ffffff” border_width=”1″ border_color=”#dddddd” ]ProjectStage[/dropshadowbox]

The most used values are Development and Production, but there is also something like UnitTest and SystemTest. When you use Development the Application Server will print more debug and log lines to the console, very useful.

 

Frameworks.

XPages has the excellent Extension Library as framework and toolbox for lots of component, UI and behind the scenes. JSF 2.0 has their frameworks.

Till now I am using PrimeFaces and MyFaces Tomahawk, they are not exclusive for JSF2.0 and higher. But when you look at older versions, there is a lack of functionality.

The 2 frameworks contains lots of components which can be easily integrated inside your application. As specially PrimeFaces has lots code examples.

 

and more….non JSF

In my project next to JSF, I also use EJB and JPA to set up Persistence to the Oracle Database. With Persistence in place you can easily do CRUD actions on objects in the Relational Database.

Tags: Annotations, Expression Language, java, jsf2.0

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • « A step outside the yellow bubble
  • Leaving the class »

Contact me

My name is Frank van der Linden and I am an independent software developer based in the Netherlands. The last 2 years I was awarded as IBM Champion. Also I am on the board of OpenNTF. My specialisations are Java, Web development and Domino.


If you want to hire me, please fill in the Contact form


IBM Champion web badge
Apache Logo

All the code on this blog are under the Apache License 2.0. For more details, see Apache License 2.0

Most recent posts

  • NL Portal, a open source project
  • 10th anniversary as a freelancer and more…
  • Engage 2020: Hello are you listening, There is stream for everything
  • Spring Cloud Function on Azure run locally
  • Deploy Spring Cloud Function to IBM Cloud

Latest reactions

  • Spring Cloud Function on Azure run locally - elstar IT on Deploy Spring Cloud Function to IBM Cloud
  • flinden68 on Quick XPages tip: add Fullcalendar plugin to your application
  • Rajesh samal on Quick tip: Swagger support for Spring Webflux
  • dsieyx on Quick XPages tip: add Fullcalendar plugin to your application
  • John on Named as IBM Champion 2019

Archive

  • November 2024
  • April 2024
  • March 2020
  • February 2020
  • January 2020
  • October 2019
  • September 2019
  • June 2019
  • May 2019
  • April 2019
  • March 2019
  • January 2019
  • December 2018
  • October 2018
  • September 2018
  • May 2018
  • April 2018
  • March 2018
  • February 2018
  • January 2018
  • December 2017
  • November 2017
  • October 2017
  • July 2017
  • June 2017
  • May 2017
  • April 2017
  • March 2017
  • February 2017
  • January 2017
  • December 2016
  • November 2016
  • October 2016
  • September 2016
  • August 2016
  • June 2016
  • May 2016
  • April 2016
  • March 2016
  • February 2016
  • December 2015
  • November 2015
  • October 2015
  • September 2015
  • August 2015
  • July 2015
  • June 2015
  • May 2015
  • April 2015
  • March 2015
  • February 2015
  • December 2014
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • June 2014
  • May 2014
  • April 2014
  • March 2014
  • February 2014

Category

  • bluemix
  • business
  • cloudant
  • community
  • development
  • hrassistant
  • openntf
  • running
  • salesforce
  • Springboot
  • Tesla
  • trailrunning
  • Uncategorized
  • watson
  • OpenNTF
  • Collaboration Today
  • XSnippets
  • Stackoverflow
  • IBM Collaboration Solutions
  • Social Business Toolkit
  • About me
  • Dutch curriculum vitae
  • English curriculum vitae
  • Google+
  • LinkedIn profile
  • Twitter
  • Slideshare
  • Blog license
  • My open source projects