JBoss Seam developer. Current tools/APIs: JSF, Facelets, Richfaces, JBoss AS, EJB3, JPA, Hibernate, Eclipse. Arbi has posted 6 posts at DZone. View Full User Profile

Seam 2.x Web Development

11.10.2009
| 8527 views |
  • submit to reddit
Published by: Packt Publishing
ISBN: 184719592X

Reviewer Ratings

Relevance:
4

Readability:
5

Overall:
3

Buy it now

One Minute Bottom Line

Very good book for beginners to Seam who are looking for lots of examples and a quick overview.  Not recommeded for advanced Seam users, they may want to look to Seam in Action by Dan Allen.  Not recommended as a reference because the amount of depth and details in the API and technology are not there.

Review

This book is an introductory guide to the JBoss Seam framework.  The intended audience is Java EE application developers who have no experience with Seam.  One drawback, in my opinion, is that the author attempted to cover a huge amount of information in a limited number of pages (284 including index).  Not enough details were provided and there was not enough breadth/depth in the topics in general.  It would have been better to have focused on Seam specific topics exclusively rather than covering ancillary information like Richfaces components.

All the same, it's a good resource for beginners to use to jump into Seam. Let's take a chapter-by-chapter look: 

Ch. 1: General high-level introduction to Seam
You'll learn what Seam is, how to install JBoss and Seam, and about deploying and running a sample application. 

Ch. 2: Developing Seam applications
This chapter very briefly covers of the following: architecture, components, bijection xml configuration files for both EAR and WAR packaging, testing, building, deployment, data validation using Hibernate Validators, and displaying errors to users.

Unfortunatley, to my knowledge, the session facade pattern that the author refers to in this chapter is out of context.  In Seam application development, there is no need for a session facade as the session facade pattern is typically used to front requests to entity beans in EJB 2.x applications. Also, I wish the author had spent more time elaborating on bijection, as it is one of the major functionalities offered in Seam.

Ch. 3: Seam Page Flow 
This chapter does a good job of describing how to configure page flow in your Seam applications.  Most of the material is focused on the pages.xml descriptor which is one of the few xml configuration files in Seam. After reading this chapter, you will know how to use the <page>, <navigation>, <rule>, and <action> elements in pages.xml to set up navigation for your pages.

Ch. 4: Facelets 
Here, the author provides explanation as to why Facelets is preferred over JSP (e.g. templating, performance, EL functions) and how to configure the web.xml and faces.config.xml for Facelets. There were a couple of basic examples for Facelets templates in this chapter which will be helpful to readers.

Ch. 5: Testing Seam Applications
This chapter covers unit and integration testing of Seam apps using the TestNG framework. TestNG supports unit testing as well as integration testing.  The author did a very good job of explaining how to do unit and integration tests using TestNG and the embedded JBoss container, along with providing plenty of code and examples.  Coverage includes mocking Seam components and how to use the @Install annotation.

Ch. 6: RichFaces
RichFaces is a UI component library for use with JSF/Seam applications that provides AJAX/Web 2.0 functionality.  The RichFaces user guide is well over 600 pages and the topic requires an entire book to cover properly.  In this chapter, the author showcases a few of the dozens of RichFaces/ajax4JSF components.  These include <rich:calendar/>, <rich:panel/>, <rich:modalPanel/>, <rich:simpleTogglePanel/>, <rich:fileUpload/>, <rich:gmap/>, <rich:dataTable/>. The author did explain how the factory component pattern in Seam works using a code example with @Factory and @DataModel annotations to populate and outject a ListDataModel instance to the JSF page so the rich:dataTable component can iterate through it.

Ch. 7: Database Persistence
In this chapter, I believe the author tries to cover way too much material in a short number of pages.  SeamGen shows up but there is no coverage of reverse-engineering the db schema and/or the hbm2java tool.  Lazy loading is referenced briefly on page 130 but there is no coverage of the dreaded LazyInitializationException and what Seam offers as a solution to that problem (Seam-managed Persistence Context, or SMPC, which keeps the EntityManager open until the conversation has ended and thus obviates the use of the Open Session in View pattern used in Spring as a workaround to LIEs).  The @PersistenceContext Java EE annotation is used to inject the EntityManager interface instance in an example on page 143, but there is no coverage of SMPC using @In annotation.  This is a glaring omission as SMPC is one of the most important topics in the Seam framework. 

On a good note, the author does introduce the @DataModelSelection injection annotation which is used quite often with clickable rows in data tables.  Finally, the author covers the Seam application framework, providing examples on how to use the home and query objects.

Ch. 8: Seam Conversations
Here, the author covers what a background, temporary and long-running conversation is and how to start and end conversations via pages.xml and annotations. The chapter wraps up with a brief discussion on conversation timeout and concurrent request timeout configurations as well as natural conversations.

Ch. 9: Seam and AJAX
This chapter basically covers Seam remoting and AJAX4JSF tags.  Seam remoting allows you to invoke a remote method annotated with @WebRemote on a Seam component from a Javascript function. AJAX4JSF is an AJAX component library that is now part of the RichFaces library. There are plenty of code examples in this chapter and the AJAX4JSF tags covered are <a4j:commandButton/>, <a4j:commandLink/>, <a4j:poll/>, and <a4j:support/>.  The <a4j:support/> tag is one of the most important AJAX4JSF tags because it allows the user to add AJAX functionality to just about any standard JSF core tag, like <h:selectOneMenu/>.  This is a very informative chapter for adding Web 2.0 capability to your web apps.

Ch. 10: Security
This chapter highlights the sophisticated security support offered by Seam.  This includes coverage of s:hasRole, a Drools example, capturing and logging user login events via @Observer annotation, the Identity Management API which is new for Seam 2.1 as well as OpenID which was not covered in Dan Allen's Seam in Action book.  Overall, very good coverage and good examples as well.

Ch. 11: Enterprise Features
This chapter is a hodge-podge of additional features in Seam that are covered very briefly.  Topics discussed are I18N, URL rewriting, Seam events, PDF document generation, Email.  This is a quick overview to get you up and running in these areas.

In conclustion, if you are an experienced Java EE developer and you are new to the Seam framework, this book will provide a quick overview of many of the different aspects of Seam.  At 284 pages, the book was too short to provide enough in-depth information and example code, however, in many cases the material was sufficient when used in combination with additional Seam reference documentation and other Seam books, like Seam in Action.

More information on this book can be found here on Packt Publishing's website. 

Published at DZone with permission of its author, Arbi Sookazian.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Michal Huniewicz replied on Wed, 2009/11/11 - 4:33am

I have this book, I have so far got through the first 9 chapters and I am disappointed. Chapters are not complete, they just merely mention random pieces of functionalities in peculiar order - this does not seem to be okay for a Seam beginner, as it leaves them on their own.

 In my experience, the book covers too much too briefly and might be a good overview of what is available in JBoss Seam, but is definitely not a guide I would recommend to Seam beginners.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.