Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Setting Up JBoss Tools for Seam Application Development : Page 2

The Seam Web Framework joins the worlds of JavaServer Faces and EJB 3.0, and JBoss Tools is a suite of Eclipse plugins that make developing Seam applications easy and productive.


advertisement
RichFaces JSF Component Library
RichFaces is a fully AJAX-enabled JSF component library that allows you to perform the usual JSF post-back cycle without having to refresh the entire page. This basically makes your web application AJAX-enabled out of the box. No additional hand coding of JavaScript is required. In short, RichFaces is designed to help you create a professional-looking Web 2.0 application with minimum effort.

RichFaces includes such AJAX-enabled JSF components as:

  • Menus (context, dropdown, etc.)
  • Tree controls
  • Graphics panels (allow dynamic painting of images using Java's graphics capabilities)
  • Tab panels
  • Date input calendars
  • Numeric input slider and spinner controls
  • Typical add/remove list controls (see Figure 1)
  • Graphical effects (fade, fold, squish, etc.)
  • Professional data grid/data table controls (see Figure 2)

To appreciate what RichFaces brings to the table, check out their online demo and then read through their very detailed manual.




Figure 1. RichFaces Skinned AJAX Data Table Components: These are typical add/remove list controls in RichFaces.
 
Figure 2. RichFaces Skinned AJAX Shuttle List Component: RichFaces provides professional data grid/data table controls.

Facelets
Although Seam supports JSP pages, the default view technology is Facelets, which has many benefits for JSF development. Its main advantages include support for templates, reusable page components, faster performance, and more detailed error reporting. Gavin King, the creator of Seam, recommends Facelets over JSPs in all the Seam documentation. The Facelets templating support alone makes it the a worthwhile choice (no more messing with Tiles for all you Struts fans).

Hibernate Validators
Hibernate Validators is a small but very useful project (which despite the name is not tied to the Hibernate library itself). It basically adds additional validators for JPA entities (see Figure 3). In particular, it allows you to specify quite a few new validations, such as:

  • @Length(min/max)
  • @Max(value=)
  • @Min(value=)
  • @NotNull
  • @NotEmpty (for strings)
  • @Past and @Future (for dates)
  • @Pattern (for regular expression based validation)
  • @Range(min=,max=)

Please refer to the Hibernate Validators manual for a complete list.

 
Figure 3. Using Hibernate Validators While Coding JPA Entities in JBoss Tools: Hibernate Validators basically adds additional validators for JPA entities.

Hibernate Validators are included in the Seam runtime and as such are automatically added to the classpath of any new Seam web project. In order to use Hibernate Validators in your code and integrate them fluidly with Seam, you need to use the built-in Seam tag <s:validateAll>, as per the example below from the Seam manual:

<h:form> <div> <h:messages/> </div> <s:validateAll> <div> Country: <h:inputText value="#{location.country}" required="true"/> </div> <div> Zip code: <h:inputText value="#{location.zip}" required="true"/> </div> <div> <h:commandButton/> </div> </s:validateAll> </h:form>

For more details on form validation in Seam, please read the form validation tutorial.

JBoss EJB 3.0 Application Server
In its initial release, Seam was called JBoss Seam and was closely tied to the JBoss Application Server (AS). However, the Seam team was eager to see it spread beyond the JBoss platform so they changed the name to just Seam and created a non-JBoss site for it: seamframework.org.

Nevertheless, Seam integrates best with JBoss AS and JBoss AS is the environment in which Seam applications most often are developed. I was able to deploy a Seam application to Glassfish, but it required a lot more configuration (in particular, all the EJB JSF managed beans had to be manually registered as EJB references in the web.xml file).

 
Figure 4. Visual Editor for Developing JSF/Seam/RichFaces/Facelets Pages: JBoss Tools offers a graphical editor for JSF web page development.

To develop applications with Seam 2.0.1 on JBoss AS, you need to download JBoss Application Server 4.2.2. Surprisingly, the default version of Seam 1.2.1 does not seem to play very well with this JBoss AS version, as I got deployment errors related to Apache MyFaces. This presumably is because, beginning with version 4.2, JBoss has used Sun's JSF reference implementation and stopped including the somewhat moribund Apache MyFaces implementation.

JBoss Tools
JBoss Tools basically is a suite of Eclipse plugins that is intended to make developing Seam applications easy and productive, using the entire software stack described above. It includes all the wizards related to creating new Seam projects and their subcomponents (e.g., conversations, entities from database), as well as a graphical editor for JSF web page development (see Figure 4).

Although it is outside of the scope of this article, the default JBoss Tools installation includes a plug-in for Struts development as well, which is very beneficial considering how entrenched Struts is in most JSP Java shops.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap