David Sills's muse is fueled by Bach, Beethoven, and Brahms (and Berlioz and Boulez). He has no life, which comports well with the über-geekitude to which he aspires. He reads and writes fitfully in English, Spanish, French, German, Italian (mostly medieval), C, VB, Perl.... Oh, and Java and XSLT, lots and lots of Java and XSLT. Trained somewhere in darkest Central America, he works today at DataSource, Inc., on the product team for the CASE tool Abri. David has posted 9 posts at DZone. View Full User Profile

Win Your Copy: Seam In Action

04.14.2009
| 11163 views |
  • submit to reddit
Published by: Manning Publications
ISBN: 1933988401

Reviewer Ratings

Relevance:
5

Readability:
4

Overall:
5

Buy it now

One Minute Bottom Line

This book is a terrific introduction to JBoss Seam, an impressive framework that is sweeping much of the competition before it. Part of Seam is even being formalized as JSR 299 (Web Beans). One can only give the book 5 stars for thoroughness, which is no easy feat with a framework that stretches tentacles into nearly every imaginable area of writing enterprise applications. If there is a downside, it is quite possibly the very thoroughness that one can also praise. The text has a tremendous amount to cover; even in nearly 600 pages (this doesn't include the free online chapters!), much has the feel of being crammed in. The writing is extremely dense, communicating as tersely as possible. This is very good in a reference work, but the whole is nearly unreadable straight through. This reviewer had to stop every few pages, just to digest. Web frameworks seem to sort themselves out into two camps these days: those that focus on HTTP and HTML, which often use JSP as a view technology; and more component- and event-oriented frameworks that seem to orient themselves around JSF and, even more recently, Facelets (the use of which Seam and the author strongly advise). I will admit my bias toward the first, but there are a number of Seam innovations that I certainly want to see introduced into my favorite frameworks.

Review

Part 1. Teeing off with Seam

Chapter 1. Seam unifies Java EE

The major concept behind Seam is to serve as an adjunct to Java EE. JSF, a relatively recent entrant to the specification, has not been uniformly a brilliant success; EJB has been a bitter pill for a long time; and other alternatives are rapidly gaining ground, such as Ruby on Rails. The Java EE specification has taken some important steps forward recently, including EJB 3.0, for instance; but we haven't yet reached the nirvana wherein JSF components cavort playfully on green fields with EJB components under the watchful gaze of JTA shepherds. Seam integrates and extends the out-of-box Java EE functionality with its own, in which the Seam context and EL play a major role. And best of all, Seam is not limited to JBoss alone!

Chapter 2. Putting seam-gen to work

One of the pluses of using Seam is how easy it is to set up your initial project structure. Seam-gen, the code generation engine of Seam, can reverse-engineer a database schema and generate a surprisingly functional web application automatically. This is both good and bad, of course: what we don't do ourselves we often don't clearly understand when it has outlived its usefulness. But it is a rush to see your data appear as though by magic on a screen. And seam-gen can be easily used from both NetBeans and Eclipse.

Part 2. Seam fundamentals

Chapter 3. The Seam life cycle

Seam steps in to support the developer concerned with the weaknesses of JSF, which are typically cases that depart from the simple HTTP request-and-response paradigm: redirects, navigation that depends upon context, and so forth. Seam handles these as close to effortlessly as could be managed, in part by participating in and adding to the JSF component life cycle. Whether it's intelligent navigation with an awareness of context, talking to EJBs, maintaining state across redirects, or one of the other deficiencies of JSF, Seam is typically there with an answer.

Chapter 4. Components and context

Context is all in Seam. The Seam context maintains variable values, injecting dependencies and retrieving values back to the context, looking up EJBs, maintaining persistence contexts (which all but eliminates those nasty LazyInitializationException messages), and so much more. The Seam context is where components are defined, initialized, and managed.

Chapter 5. The Seam component descriptor

Annotations are heavily used in Seam to avoid the use of XML descriptors where possible. But there are some things for which annotations (and possibly even Java code) are not the best solution, and Seam provides a great deal of functionality by way of configuration. This does require descent into the depths of XML, especially as Seam includes a number of built-in XML namespaces that help configure useful functionality from integration of email and user authentication to UI themes and persistence. Resource bundle management is another important feature of Seam descriptors.

Chapter 6. Absolute inversion of control

IoC and dependency injection (DI) is central to a number of important frameworks of late. Seam extends the idea of DI to include not only injection of values from the Seam context into an object when it is used (not only when it is created) but also out-jection of values from the object back into the Seam context once the operation has been performed (the combination is called bijection). This process is managed by method injectors that can, if needed, be disabled. Seam also allows the developer to raise events from components and pass those events to interested observers.

Part 3. Seam's state management

Chapter 7. The conversation: Seam's unit of work

One of the important additions of Seam to the management of user state is the concept of conversation. This is a scope, like the more familiar request and session scopes, but more long-lasting than the former and less so than the latter. Many use cases require interaction with a user over a series of pages; the conversation scope is perfect for holding state within such interactions. The user can even hold multiple conversations within different browser tabs or windows and Seam manages the lot! The developer also gets the benefit (over handling this with session variables) that Seam automatically cleans up after itself. Delineating conversation scope can be managed in the usual variety of ways.

Chapter 8. Understanding Java persistence

Seam supports both Hibernate, a mature object-relational management solution, and JPA, a rather newer but more standard one. Owing to Hibernate's relationship to JBoss, support for it is not too surprising; Hibernate also doubles as a JPA provider, so again support for it is unsurprising. Seam adds a special feature to the EntityManager in the latter, enabling it to remain open and available throughout the request to avoid issues with lazily initialized properties. In addition, because entities don't have to be detached, issues raised by merging can be completely avoided.

Chapter 9. Seam-managed persistence and transactions

The extended EntityManager does raise issues, however. Who opens it? Who closes it? What are the bounds of transactionality? All of these are issues Seam helps the developer to artfully handle. Transactionality is one area where Seam adds considerably to the defaults of Java EE, enabling separate transactions covering business logic and rendering-driven event handling. This avoids the all-too-frequently-encountered case where rendering errors might unexpectedly roll back successful business transactions. Seam also helps manage proper isolation and flushing of the persistence context.

Chapter 10. Rapid Seam development

Seam defines a subset of its classes (referred to in the text as a "framework within a framework") under the name Seam Application Framework. These classes taken together are the secret to Seam's being able to easily handle simple database applications. Learning to configure and use these is the subject of this chapter. Among the classes discussed are a number of extremely useful ones, including a Query component that is context-aware and can paginate effortlessly.

Part 4. Sinking the business requirements

Chapter 11. Securing Seam applications

You didn't really think that Seam was going to go this far and leave you high and dry as to user authentication and authorization, did you? Where JAAS stops and well before Acegi Security (now Spring Security) drops you into XML-land, Seam steps in. With the identity management module introduced in Seam 2.1, you can even manage most of the problem using annotations and configuration. Authorization in Seam is typically managed using roles assigned to users (even using Drools, the JBoss rules engine!) but roles can be adjusted if need be in specific use cases to allow users to do what they might not be able to otherwise.

Chapter 12. Ajax and JavaScript remoting

Ajax is all the rage, enabling web pages to become active and responsive in real time, as desktop applications typically are. JSF, however, came out before Ajax and the latter is still not included in the JSF specification. Attempts to integrate Ajax and JSF include the Ajax4jsf and ICEfaces projects, which make it relatively simple to enable communication between the JSF server and the web page. This is essential because in Ajaxified projects the web page is at risk of being out of date with developments on the server as soon as it is sent off. This chapter illustrates how these toolkits and the Seam life cycle can work together to enrich the user experience. GWT, another popular Ajax-based framework, is also briefly touched upon.

Chapter 13. File, rich rendering, and email support

Isn't this enough, already? Not quite. Seam also simplifies several common use cases: handling file uploads and rendering uploaded images; using iText to generate PDF reports; using JFreeChart to generate charts dynamically; generating emails, including attachments and embedded images; and producing RSS feeds. Brief additional mention is made of managing resource bundles and UI themes.

Chapter 14. Managing the business process (online)

Business process management (BPM) is another buzzword we encounter frequently. Business processes stand out from typical single-user web interactions because their flow typically involves a number of people performing a variety of tasks. Seam's out-of-box support for BPM is based on another scope, as support for conversations was for single users. At present, the Seam implementation supports only jBPM from JBoss, but conceptually its support is not tied to JBoss in this as in other aspects. Seam's contribution to BPM is to support contexts and components that can integrate business processes into an application.

Chapter 15. Spring integration (online)

By now you're raring to go with Seam, which is great, but not to throw the baby out with the bath water! Leveraging your Spring experience may be important. Spring and Seam explore some different areas and using them together can more than double your number of solutions. The most obvious points of contact include finding each other's components (beans in Spring) and sharing in the persistence arena. This chapter explores how to make these two powerful frameworks work together for you.

Appendix A. Seam starter set

This appendix helps you get started with Seam by detailing the tools you will need to begin working. Setting up the JDK, an application server, even Seam itself is covered. And Seam can even be used with Maven 2 or Ivy!
Published at DZone with permission of its author, David Sills.

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

Tags:

Comments

Andy Pemberton replied on Tue, 2009/04/14 - 4:18pm

I'm excited to check it out, and more excited to hear Dan speak at Richmond JUG in the next few months.

Christian Maslen replied on Tue, 2009/04/14 - 7:03pm

A comprehensive review and having also read the book a rating I agree with. Chapter 6 alone is worth the purchase price. For those not familiar with Seam I recomend checking it out and using this book to help you out.

 

Christian.

Roger Studner replied on Tue, 2009/04/14 - 7:09pm

I already own the book.. and wanted to comment.

 

This is an amazing book.   Simple as that.

 

I've been a very long time Spring user (near evangelist)... and reading this book.. makes me wish I could work on a Seam project.

 

The tech/presentation is just awesome.

 

Jasen Jacobsen replied on Tue, 2009/04/14 - 8:33pm

I have this book. It's been a few years since I've done Java web development - Tapestry 4 was the last framework I used. I enjoyed the book's first few chapters - seam-gen intro and the Open18 walk through, but then it dove down into the details a bit too deep for me. I also have "Seam Framework: Experience the Evolution of Java EE". That book takes the opposite approach of "Seam In Action". SiA starts with a seam-gen application; SF starts with "Hello World" and builds up from there. I'm finding SF more beginner friendly, but certainly hope I will build up to making use of JiA. JiA seems oriented toward people who are familiar with the J2EE technologies Seam integrates and can appreciate the explanations JiA provides. Unfortunately, that's not me - yet. - Jasen.

Jesse Sightler replied on Tue, 2009/04/14 - 9:10pm

I've used Seam fairly extensively with Tomcat and ICEFaces. Overall, the experience has been quite positive, however, the learning curve can be rather steep at times. Just the security related features within Seam are worth the cost in time, though, IMO.

Hantsy Bai replied on Tue, 2009/04/14 - 10:14pm

Good book for learning Seam.

 

Álvaro Martínez replied on Wed, 2009/04/15 - 3:52am

Great review, I'd like to read this book!

Paul Slattery replied on Wed, 2009/04/15 - 3:56am

Great review , seems to follow the structure of the other 'In Action' series.

Looking forward to reading it.


P

Christian Voller replied on Wed, 2009/04/15 - 5:33am

Sounds great. Just want this book:-)!

Stanislav Poljovka replied on Wed, 2009/04/15 - 6:58am

I am sympathizer of Seam technology and I look forward to next step of this technology (JSR??? - WebBeans).

Marco Donati replied on Wed, 2009/04/15 - 8:41am

I agree with this revision.
"... The writing is extremely dense, communicating as tersely as possible. ...": Yes, it's true. The writing is extremely dense and careful. I've used this book in teaching phase, when you must learn Seam fundamentals, and later, when you must put a finish touch to your knowledge. Seam in Action save me from the labyrinth of "conversations"; however, Seam save me from the Java Enterprise problems.
My experience with Seam: i'm focusing to the model (without persistence worries) and to the web designs (using css templates). The rest: someone @ and someone {#} scattered here and there.

Zaheer Paracha replied on Thu, 2009/04/16 - 10:02am

Great review, I'd like to read this book.

Ram Kompella replied on Thu, 2009/04/16 - 10:23am

thanks for the nice review. Looks intersteing.

Is it just integration of different technologies or doesnt provide any added enhancements?

 Is it worth learning SEAM? How is the market for Seam?

Shaji Ravindran replied on Fri, 2009/04/17 - 7:41am

nice review,seems to be an interesting book..

Sudhakar Ramasamy replied on Sat, 2009/04/18 - 10:22pm

I like the review...it goes into considerable detail for a review giving me a sense of what to expect. Seems like a good reference book to have handy when I get into Seam development.

Sudhakar Ramasamy replied on Tue, 2009/04/21 - 6:17pm

Do we know when the drawing and announcement of the winner of the free book is going to take place?

Wei Ling Chen replied on Tue, 2009/04/28 - 9:48am in response to: Andy Pemberton

Hi guys,

Thanks for all the comments. I am proud to announce Andy (pembertona) is the winner for this book. Congratulations Andy. Check out other free book offers every week. 

Thanks, 

Wei Ling

shanshan gan replied on Fri, 2009/05/29 - 8:23am

I am a fresh man with seam.But with some demos ,I think it very beautiful.

Comment viewing options

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