- Andrew Kos
- Bill Burlein
- Bryan Williams
- Christian Vozar
- Jeff Brown
- John Kraus
- Joseph Mak
- Mark Daugherty
- Matt Van Bergen
- Melissa Geoffrion
- Michael Kang
- Michael Chan
- Michael Hodgdon
- Mike Motherway
- Molly McDaniel
- Nadia Maciulis
- Pat McLoughlin
- Paul Michelotti
- Puru Hemnani
- Rohit Srinath
- Ryan Lunka
- Tom Kelly
All Blogs
CITYTECH Blogroll:
Why You Should Consider JBoss Seam for Your Next Project
Tuesday, January 5, 2010
Introduction
I recently had the opportunity to convert a Microsoft Access-based application to a web-based application using JBoss Seam. Having used many Java web frameworks the past few years, including Grails, Wicket, and Struts 2, I wanted to highlight some of the key features in Seam that help differentiate it from some of the other framework contenders. The intention of this blog isn’t to start any flamewars by comparing Seam on a feature by feature basis with other Java frameworks, but simply to focus on the areas of Seam that I feel help make it a solid choice when starting out on a new project.
Seam-gen
Seam ships with an application generator tool called seam-gen. The purpose of seam-gen is to allow for the automatic creation of various application artifacts, including common configuration files, a build script, and directories for source and view code. It can also automatically generate a complete CRUD application based on an existing database schema. For the project that I worked on, this came in especially handy since I had an existing database to work with. Seam-gen did a tremendous job in creating the CRUD source and view code, complete with pagination, searching, and sorting of data. The code that was created was so complete that very few tweaks were required to make it production ready.
State Management
With Seam, gone are the days of having to manage application state programatically. All Seam components have a default scope as well as a scope that can be set using annotations. Once a component is annotated, Seam takes over the rest so the programmer doesn’t have to worry about managing the component’s creation, state, and removal. Seam also introduces a new scope not seen in any of the other application frameworks: the conversation scope, which is similar to the session scope used in most web frameworks, although more powerful. As opposed to the HttpSession, a conversation allows multiple state containers for a single user. This allows multiple application tabs or windows to be opened and worked on without worry that the work being performed in one tab or window will overwrite that being performed in another tab or window.
ORM Best Practices
It’s no surprise that Seam makes use of ORM best practices since it was created by Gavin King, the inventor of Hibernate. Seam manages the persistence context from the time a request comes in to the time a response is rendered. This relieves developers from having to implement data access hacks or having to worry about various ORM errors, such as the dreaded LazyInitializationException. Another major benefit of having the persistence context managed by Seam is that performance can be greatly improved since the extended persistence context acts as a cache, storing database queries in-memory and only committing them to the database at the end of a conversation.
Third Party Library Integration
Seam provides several features to allow for the seamless integration with third party libraries. By simply bundling a few JAR files in your application, you can easily perform tasks such as generating PDF reports, sending email, displaying rich text, and creating charts. Seam allows this integration to be performed by providing simple tags that can be dropped onto a web page and then used just like ordinary JSF tags. For example, by wrapping content in a <p:document> tag, Seam generates a PDF document by leveraging the open source iText library. Similarly, Seam includes tags to integrate with the JavaMail API for sending mail, the ANTLR API for displaying rich text, and JFreeChart for creating charts.
AJAX Support
Seam has leading-edge support for integrating AJAX in an application. Without writing a single line of JavaScript code, Seam applications can become AJAX enabled. This is a great feature for those who aren’t JavaScript experts. By adding just a few simple lines of code to the project that I worked on, the application was able to provide instant validation to form fields as well as performing data searches without doing a full page refresh, giving it a true desktop-like feel.
Summary
Choosing a Java web framework is not easy. New frameworks appear everyday and get added to the long list of options. While no framework is a silver bullet that will solve all the needs of a typical web application, I highly recommend having a look at the Seam framework to simplify your web programming needs.
Jeff Palmer
Recent Posts
- Invisible requirements within Business requirements
- Building a better Options Predicate
- Javascript, This, and You.
- Extensionless URLs with Adobe Experience Manager
- The Life of a Tester in Adobe CQ World!
- Limitations of the CQ Parsys Model and the Implementation of a Nested Paragraph System
- Google Analytics and AEM: No JavaScript? No Problem.
- Using Apache FOP to generate a PDF document based on a form submission data
- Configuring SAML in AEM 5.6
- Why You Should Get the WCM Experts Involved Early