alt
March 28th, 2010

by Ivan St. Ivanov

Hello Facelets, goodbye JSP

JavaServer Faces (or JSF) 2.0 is the preferred view technology in Java EE 6. Not only it lets you build rich UIs using various technologies (like AJAX for example), but you can also easily build reusable and composite view components. Although the JavaServer Pages (JSP) is still supported by the specification, JSF as of its 2.0 version will officially use the Facelets technology for the view description.

Facelets uses the same known tag libraries (JSTL core, JSTL functions, JSF core and JSF HTML) and on top it adds the JSF facelets library. It mainly contains tags for component definition and composition. Thus you can once create a login form component for example, put it in a JSF file (with extension xhtml) and then embed it in other JSF files and pages.

The above article is another good introduction to the JSF technology and the Facelets. The good news in the JSF area is that the books about version 2.0 are already coming. Ed Burns’s JavaServer Faces 2.0, The Complete Reference can already be bought. And in a month Core JavaServer Faces 3rd edition is coming. So if you want to give JSF a chance, at least read all the introductory articles like this one. :-)

Bean validation and JSR 303

One of the tasks of most of the web (and not only) applications is validating user input. Especially when the user enters some data in a form, it has to be checked whether it conforms to pre-defined rules. Sometimes the field should not be empty, other times it should be a number. Of course the business logic of the application can define very complex rules about the object attributes and the corresponding fields of the input forms.

As you can read from the article, back in the time there were two major validation frameworks: Apache Commons Validator and the Action forms validator in Struts. The third player in the game is Hibernate. Its validator framework called Hibernate Validator is now the reference implementation of the bean validation JSR. In a nutshell, you just annotate your model classes with validation rules. Then in the business layer you just call the validator API to check whether all the rules are applied with the objects coming after the user input. This helps implementing the validation logic only once and not in every layer of the application. Easy and straightforward :-)

Performance monitoring with Hibernate

The database performance is very important for the overall application efficiency. This article presents a special API from Hibernate that analyzes exactly that. Hibernate Statistics gives us valuable information about such things as number of executed queries, open transactions, loaded entities, etc.

The author of the article gives us a hint how this statistics can be used to monitor some common performance problems. You can also see how you can deploy your code as a Java EE library and use it seamlessly during your application’s runtime.

JavaFX digital clock

And now something for the JavaFX fans. This is the emerging Java visual technology with its own language (JavaFX script). With its help you can do compelling graphics and animation without writing the tons of code, inner classes, getters and setters required by Swing.

This article is very useful in that it is a step-by-step example of creating a real world (though simple) application. The author walks you through all the way from creating the project in NetBeans to running the application. Although declared as requiring intermediate skill level, it can be a perfect start even for those of you, who (like me) have only heard about the basic terms and benefits of JavaFX.

Soft skills article of the week

Most of the readers of this blog have at least once gone to a job interview. In most of the cases the employee candidates are usually the ones that answer the questions. The only thing that they really ask is the amount of the salary.

Not that it is not important, but according to the author of this short blog post, there are at least 10 questions that you should ask your future boss on the job interview. If you have some experience in this area, you can post your ideas as comments.

Leave a Reply

CAPTCHA Image
*


5 + four =