Saturday 21 December 2013

How to know the .class is complied by which jdk version?

In a compiled class (.class file) we see is “ca fe ba be”. This is the java magic number which says that this is a java binary class file. It is immediately followed by minor_version and then major_version.

Sample hex view of a java binary class:
ca fe ba be 00 00 00 32 ...

Sunday 15 December 2013

Java Server Pages

Java Server Faces (JSF) is a Java-based web application framework intended to simplify development integration of web-based user interfaces.

JSF 2 uses Facelets as its default templating system. Other view technologies such as XUL can also be employed. In contrast, JSF 1.x uses JavaServer Pages (JSP) as its default templating system.

JSF is often used together with Ajax, a Rich Internet application technology. Ajax is a combination of technologies that make it possible to create rich user interfaces. The user interface components in Mojarra and Apache MyFaces were originally developed for HTML only, and Ajax had to be added via JavaScript.

Latest developments

Facelets (which was designed specifically for JavaServer Faces) was adopted as the official view technology for JSF 2.0. This eliminates the life-cycle conflicts that existed with JSP, forcing workarounds by Java developers. Facelets allows easy component/tag creation using XML markup instead of Java code, the chief complaint against JSF 1.x.

The new JSF developments also provide wide accessibility to Java 5 annotations such as @ManagedBean, @ManagedProperty and @FacesComponent which removes the need for faces-config.xml in all cases except framework extension. Navigation has been simplified, removing the need for faces-config.xml navigation cases. Page transitions can be invoked simply by passing the name of the desired View/Facelet.

Addition of Partial State Saving and DOM updates are part of the built in standardized Ajax support.
The latest JSF release has built-in support for handling resources like images, CSS and Javascript, allowing artifacts to be included with component libraries, separated into JAR files, or simply co-located into a consistent place within the web-application. Includes logical naming and versioning of resources.

JSF 2.0 also includes a number of other changes like adding support for events, separate development, staging, and production modes, similar to RAILS_ENV in Ruby on Rails, and significantly expanding the standard set of components.