Along with Seam 2.1 comes a handful of enhancements to seam-gen. These changes are a culmination of the mods I made to the seam-gen project that forms the basis of the sample code for Seam in Action. Perhaps after reading this entry, you'll conclude that the enhancements go well beyond modest.

The improvements to seam-gen can be classified into four categories:

  • look and feel
  • functional
  • project structure / build
  • seam script

Since we're all attracted to shiny new things, let's start with the style upgrades and supplement the discussion with some screenshots.

Freshening up seam-gen's look

Both RichFaces and ICEfaces seam-gen projects already carry a touch of elegance thanks to the component styling controlled via CSS-based themes (i.e., skins) bundled with the two libraries. The styles that get imported with a theme are most apparent in the rich layout components from the JSF component sets (e.g., <rich:panel> and <ice:panelTab>). But there are some areas of the page that don't get coverage, such as the form elements and status messages. I figured out a way to stretch the theme across the whole page using RichFaces' theme extensions and some better default styles (unfortunately, the theme extensions only apply to RichFaces projects at this point).

Although it may seem trivial to worry about how the application looks, these style improvements are an important first step to ensuring that your application looks more presentable down the road (giving you one less thing to worry about early on in the project).

Extending the RichFaces skin

RichFaces uses skins to decorate its built-in components. But what's neat is that this skinnability feature is left entirely open to extension. A skin is nothing more than a message bundle that maps colors and font sizes to key names (e.g., panelBorderColor). Each rich component (e.g., <rich:dataTable>) is bundled with dynamically generated CSS that references these key names to style the component according to the theme.

The CSS is generated from an XML-based CSS file, which uses the file extension .xcss. The syntax used in this file consists of both standard and special skin-aware elements and attributes that translate into CSS. To extend the theme, you simply create a custom .xcss file and import it into your page using <a:loadStyle> from the Ajax4jsf component set. If you need to customize the colors and font sizes, or even add an additional skin property, you simply create a file named and place it at the root of the classpath. You replace %SKIN_NAME% with the name of the RichFaces skin (e.g., emeraldTown).

Details, details, details. Where's the benefit? Well, through the power of CSS, we can make non-RichFaces components look rich! And it's not just about colors, either. It's even possible to generate gradient images using one of the special elements in xcss (<f:resource>). That means we can make slick looking form elements. In seam-gen projects, these additional theme-related styles are defined in the file theme.xcss, which sits adjacent to the existing theme.css file. Here's a snippet from that file which styles text inputs:

<u:selector name="input[type=text], input[type=password], textarea, select">
  <u:style name="background-color" skin="controlBackgroundColor"/>
  <u:style name="color" skin="controlTextColor"/>
  <u:style name="background-position" value="left top"/>
  <u:style name="background-repeat" value="repeat-x"/>
  <u:style name="background-image">
    <f:resource f:key="org.richfaces.renderkit.html.images.SliderFieldGradient"/>
  <u:style name="border" value="1px solid"/>
  <u:style name="border-color" skin="tableBorderColor" />

Here's the CSS that this XML markup produces (for the DEFAULT RichFaces theme):

input[type="text"], input[type="password"], textarea, select {
  background-position:left top;
  border:1px solid #C0C0C0;

And here's how an input generated by a plain old <h:inputText> would look:

Keep in mind that the input's style is going to coordinate with the RichFaces theme. That's true of all form elements as well as the general font color and the color of links. See for yourself in the next section.

Showing off the new look

Below is a collection of screenshots, which are taken from a seam-gen project generated from the vehicles schema used for testing seam-gen. These screenshots show off the new styles as they look with various RichFaces themes. The RichFaces theme is controlled using the org.richfaces.SKIN servlet context parameter defined in web.xml:


The first thing you'll notice when you deploy a seam-gen 2.1 project is that there is a new home page featuring the Seam logo. Beyond that, you should simply notice that the elements on each page below all coordinate with the selected theme.

You'll notice in these next two screenshots that I have customized the status messages, also true for ICEfaces projects. An appropriate icon is used in front of each status message according to its level (warn, error, and info). While working on this enhancement, I fixed JBSEAM-1517 so that the messages look presentable and don't overlap. (Believe it or not, the messages were still using the orange style from the original seam-gen, which didn't match at all with the RichFaces or ICEfaces theme).

The cherry on top of all this is the favicon of the Seam logo, which is defined in the main Facelets template and appears in the URL location bar. I think this is the sweetest enhancement because it gives you that pride that you are using Seam.

The only downside of the new theme is that the Visual Editor in JBossTools doesn't understand the xcss file. That's why I left behind an improved version of the theme.css file, which is still used in the main Facelets template. In it, I define static CSS styles that don't rely on the skin properties. It certainly would be cool if the Visual Editor could interpret the xcss file as it would make developers more productive when extending the RichFaces theme. Currently, after making a change to the xcss file, you have to do a hard restart of the application to get RichFaces to reload the generated CSS (and with some browsers you also have to clear out the browser's cache).

That's enough about styles for now. There are a couple other enhancements to the application's presentation that fall more along the lines of functional, so we'll look at those next.

Just what the boss ordered

As I talk about enhancements to seam-gen, it's important to keep in mind the purpose of seam-gen so we don't lose perspective. seam-gen provides two key services:

  1. A starting point for developing with Seam, saving you from getting started tedium
  2. A broad demonstration of Seam features that you can begin building on

seam-gen is not going to do your job for you. With that said, there were a lot of areas of inconsistency in the generated project and other things that seam-gen could do better. Here's a list of functional changes that were made to seam-gen projects, which were mostly developed to satisfy requests that trickled down from management:

  • Human-readable labels are generated from property names using a camel-case translation (i.e., camelCase => Camel case)
  • The proper converter is applied whenever outputting the value of a property (e.g., date, time, number)
  • Icons are used in the tabs on the detail pages to denote parent and child associations
  • The markup for the sort links in the column headers on the listing pages is simplified using a Facelets composition template
    <ui:include src="layout/sort.xhtml">
      <ui:param name="entityList" value="#{personList}"/>
      <ui:param name="propertyLabel" value="Name"/>
      <ui:param name="propertyPath" value=""/>
  • Client-side sorting of columns in the child association table is enabled on the detail pages (leveraging the RichFaces table)
  • Activated sorting on the listing page for properties on a component or composite key (e.g.,
  • JPQL used for sorting is now compliant
  • Added a link in each row on the listing page to edit the record (previously only possible from detail page)
  • Changed the default username to admin, still allowing any value for the password. The failure login scenario can now be triggered out of the box.
  • One-to-one associations are linked up in the UI the same way as many-to-one associations
  • Introduced a head named insertion in the main Facelets template (view/layout/template.xhtml) for adding additional markup to the <head> element on a per-page basis
    <ui:define name="head">
      <script type="text/javascript">
        window.onload = function() { ... }
  • Moved the <h:messages globalOnly="true"> declaration to the main Facelets template and conditionally check a Facelets parameter named showGlobalMessages to turn them off on a per-page basis
  • The conversation is not propagated by links in the main menu bar (i.e., propagation="none")
  • Added a button to reset the search on the list pages
  • The entity manager is switched to manual flush mode when editing a record
  • A UI command link was added to to the debug page for destroying a selected conversation (not specific to seam-gen)

I'm sure there are other small enhancements that I am forgetting about, which I will leave for you to discover. Let's move on to the project structure and build changes.

Semantically speaking

seam-gen projects are still built using Ant and they still have fundamentally the same (quirky) structure. What I did, though, was fix a semantic error. I changed the source directories so they better reflect how they are built rather than what classes they contain. In Seam 2.0, the two main source directories were:

  • src/action
  • src/model

Components in src/action were added to hot deployable classpath when running in development mode, whereas components and regular classes in the src/model directory ended up on the main (static) classpath. In production mode, of course, the resources in these two directories both would end up in the same classpath. The problem is that hot deployable components are not necessarily action components and non-hot deployable components are not necessarily model classes. To fix this semantic mixup, the source directories are now:

  • src/hot
  • src/main

I trust that you can immediately grasp the purpose of these two source directories and thus feel more comfortable finding a place for the class you are about to create. Unfortunately, JBossTools still uses the old convention for the time being. Despite the difference, it has no problem consuming a seam-gen project with the new folder names since, internally, it relies on a mapping between folder name and function (seam-gen prepares the mapping configuration to reflect this new convention).

Naturally, the project build script was updated to accommodate the new names for these source directories. But there are several other changes that came out of my meddling with the build.

More muscle under the hood

First and foremost, tests which extend SeamTest can now be run using Java 6! This was a huge frustration for me and I am thrilled to have worked out a solution. The issue is really that the Embedded JBoss container is sorely out of date and flakes out on Java 6. Until a newer version of Embedded JBoss is ready, the workaround is to use and endorsed JAR file to fix a conflict with JAX-WS and to allow a special array syntax specific to the Sun JDK. You can check the test target in the build file for the specifics.

Fans of Groovy will be excited to learn that it's now possible to use Groovy components in EAR projects. The EAR project build compiles Groovy scripts on the classpath using groovyc, making them bona fide Java bytecode. (Getting seam-gen EAR projects to interpret .groovy files at runtime requires some more research). But what's even more exciting is that you can now write tests in Groovy (again compiled using groovyc) and test components written in Groovy. Really, this was just a matter of putting the build logic in place, but it's still important to know that you can get the Groovy support right out of the box. There's still work to be done to make the support for Groovy more elegant, but for now it is at least comprehensive.

Here's a bunch of other goodies that were thrown into the build:

  • seam-gen WAR projects now have a consolidated compile target
  • two new targets, reexplode and redeploy, execute clean unexplode explode or clean undeploy deploy, respectively
  • the restart target now detects if you have deployed an exploded or packaged archive and restarts the application appropriately (before it bombed if you had a packaged archive deployed)
  • the view folder is added to the classpath during the execution of tests so that page actions defined in fine-grained page descriptors (i.e., .page.xml) get invoked properly (previously tests only read the global page descriptor (i.e., pages.xml)
  • a new target named javadoc generates JavaDoc API from the project source

If you are interested in getting the dependencies of a seam-gen project under control, check out my article about how to manage the dependencies of a seam-gen project with Ivy.

That wraps up just about all the changes to seam-gen projects. All in all, what these upgrades should do is make your demos of Seam look just a touch prettier and give you more hammers to swing during development. Obviously, there are still plenty of improvements that could be made, so feel free to contribute them. Patches generated with svn diff are preferred.

In the final section, I want to talk about the changes that were made to the seam script and the different ways that it can now be invoked.

Removing the shackles from seam-gen

The seam script (which we all call seam-gen) has finally been set free. In the past, the seam script hasn't been as comfortable to use as other project generation tools, such as Grails, because the developer has been locked into having to execute it from a Seam distribution directory. The approach that Grails takes is to add the location of the grails script to your PATH, set GRAILS_HOME, and use the script like a system command. I have an approach that falls somewhere in between and that I believe is more flexible.

Thanks to changes in the bootstrap script, you can now run seam out of any directory on the computer and it will work as it does today (meaning your current working directory can be anywhere). The seam script still has to reside in a Seam distribution directory or the SEAM_HOME environment variable must be set if it doesn't, but now you have a third option of creating a symlink to the seam script from a directory already on your path (such as ~/bin). Internally, the script figures out your current directory and the SEAM_HOME environment variable relative to the location of the script (there is no reason to make the developer set the SEAM_HOME environment variable, though it's still honored if present). More on the current working directory in a second. The point so far is that the seam script is going to work from anywhere. No more silly restrictions.

As a side note, I want to mention that I added a validation check in the bootstrap routine that verifies the user has the JAVA_HOME environment variable defined and that it resolves to a valid JDK installation. Otherwise, the Ant build is going to fail anyway.

Ever since Seam 2.0, the seam create-project command has been moving the that holds the responses from seam setup to the file in the root of the project. But we haven't done anything with this file yet...until now. Here's the big enhancement (the one you have all been asking and waiting for).

If your current working directory has a file AND and build.xml file, then the seam script recognizes that you are in a seam-gen project and operates using the file in that directory rather than the seam-gen/ in the Seam distribution. If you put the seam script (or a symlink to the seam script) on your PATH, then you can simply enter a project and run seam generate. If the seam script is not on your PATH, then you have to run something like ~/projects/seam-2.1.0.GA/seam generate. It really doesn't matter how it is invoked. This works across the board on Linux, Windows, and Mac. (By the way, writing cross platform scripts is a huge pain).

When your current directory is a seam-gen project, you essentially have the choice of using the seam script or the ant command to run the targets. The seam script is beneficial if the ant command is not on your PATH, though if you have Ant installed, then the seam script is just a middleman. That is, unless you are executing a code generation target (e.g., new-form, generate). Then you do need to use the seam script.

So there you have it, you can now use seam-gen to manage multiple projects and you can execute code generation from within the project! But wait, there is even more! If you don't yet have a seam-gen project created, you can feed a properties file of your choice into the script using the flag:


The value of the property must either be an absolute file path or a path relative to the root of the Seam distribution. You can also override the location of the seam-gen directory or even just the seam-gen templates (if you keep a customized version) using -Dseam-gen.dir and -Dtemplates.dir, respectively. It may be a little obscure to have to pass -D flags to the seam script, but it gives you the power you are looking for.

I hope you're excited about all the enhancements that I presented in this article and that it helps you to become more productive with your seam-gen projects. There is still work to be done, including a major refactoring of the seam-gen build system, which I am going to start documenting on this wiki page. But for now, you should have plenty of new toys to play with.

20. Oct 2008, 14:57 CET | Link
Timothy Whitehead | timothy.whitehead(AT)

I believe that composition components are a better fit for sorted columns than composition templates. It would also be nice to have a basic composition component set up in seam gen. I spent my first few weaks with seam developing a set of composition components then converting my seam-gen generated project.

My sorted columns looks like this:

In the xhtml:

<val:sortedColumn label="Code" backingBean="#{airportList}"  fieldName="code" fullField="#{airport.code}" />

The compostion component:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns=""
	<c:if test="#{empty rendered}">
	    <c:set var="rendered" value="true" />	
	<h:column rendered="${rendered}">
		<f:facet name="header">
			<c:set var="asc" value="${fieldName} asc" scope="request" />
			<c:set var="desc" value="${fieldName} desc" scope="request" />		
			<s:link value="${label} ${(backingBean.order==asc) ? messages.down : ( (backingBean.order==desc) ? messages.up : '' )}" title="sort">
				<f:param name="order" value="${(backingBean.order==asc)?desc : asc}" />			
		<h:outputText value="${fullField}"  styleClass="${styleClass}" >
			<ui:insert />

I find it makes my pages much neater.

It could still use some improvement, for example it does not work if the column contains Enums.

20. Oct 2008, 18:56 CET | Link
Thai Dang Vu

maven does it, why doesn't seam-gen?

20. Oct 2008, 19:02 CET | Link

Glad you asked about IntelliJ IDEA. There are project files in the works! Expect it in the next minor release (and perhaps attached to a JIRA in a couple of days).

20. Oct 2008, 19:12 CET | Link

I agree that the most elegant solution in Facelets is to use custom tags. I'm assuming you would declare you tag in a Facelets configuration file as follows:


The downside with this approach is that you don't get tag completion in the editor (because there is no definitive structure to the tag). For right now, that is a customization you would need to make to the seam-gen templates (which you can easily do now).

Good idea for the enums. I forgot about that. It shouldn't be difficult to support them. Can you file a JIRA?

21. Oct 2008, 05:29 CET | Link

On the same topic (almost). I tried to setup the seam project (i.e. the framework development itself) within intelliJ. It was hard ... possibly I picked the wrong approach, I don't know. (Actually, the whole trunk checkout seems well prepared for those who use Eclipse. Doesn't any of you seam guys use IntelliJ?)

Do you have a suggestion on what would be the easiest way to get going with Seam development in IntelliJ?

21. Oct 2008, 17:07 CET | Link
Timothy Whitehead

I have filed a Jira.


Regarding custom tags and tag completion, does anyone know how to make this work? Can I create a dtd or something? Also it would be nice if JBoss Tools could handle custom tags in the preview.

Custom tags are a cant live without for me, as they make the pages so much simpler and easier to maintain.

22. Oct 2008, 02:17 CET | Link

Your point resonates strongly with me. For the most part, Seam developers are using Eclipse, but I agree that the project structure should be digestible by any IDE (or at least the major ones). The good news is that an initiative has begun to restructure the Seam project, which should solve this problem.

22. Oct 2008, 02:22 CET | Link

IDE support for custom tags is an important point. I would say we need to bring an issue up in JBossTools, but also it is important to consider if this will be supported in JSF2. Clearly, some metadata will be required. I'll throw the question out there and see what happens.

22. Oct 2008, 02:51 CET | Link

Here is Pete's response:

JSF2 has an optional metadata system for EZComp for tooling support, it may be based around some other JSR (forget which) for metadata, can't remember - this is in EDR IIRC. As for "ad hoc" (current) facelets tags, I think the tooling can't do much about those, especially as JSF2 allows autodiscovery of them from the CP.
23. Oct 2008, 22:18 CET | Link

Note that you might run into a bug that was caused by a typo in two of the freemarker templates in Seam 2.1.0.GA! I fat fingered the word identifier and it slipped through our seam-gen test. We are adding coverage for this area of the code.

Please see JBSEAM-3617 for a patch. This issue will be resolved in Seam 2.1.1.CR1.

23. Oct 2008, 22:20 CET | Link

The link to the JIRA issue was broken. Try this one: JBSEAM-3617.

11. Nov 2008, 21:55 CET | Link

Looking much forward to that then! (This one I guess ?)

07. Jun 2009, 13:27 CET | Link

Thank you for the Seam-Gen update!

09. Jun 2009, 14:00 CET | Link
Stephen Strenn

Great work! The UI improvements are much appreciated, as I tend to build a lot of prototypes for demonstrations.

20. Apr 2010, 02:57 CET | Link
tak-po li |

Richface is good. However, how can I generate a page with NO face, neither Richface or Iceface, is needed. I want to jump to a pure Dojox gfx page. However, when I jump for firebug I saw some .js files related to Richface is loaded. It looks that kill the gfx event handling.



16. Jun 2010, 12:36 CET | Link

Hi all,

I have developed an application in seam and richfaces. Anyone please let me know how to change the background color of a page. Instead of white i want a different color. What should i do inorder to accomplish this?

22. Aug 2014, 09:21 CET | Link

Different well known waste that rolex submariner replica add some star artisan admirer bracelets in addition to silver or maybe sterling silver pearly white's or maybe grillz. There are hip hop over unity magnetic bracelets, topic snowchains, belt buckles, re-write solution happens to be in addition to chains. That cheap cartier replica watches is usually utilized clothed decrease or maybe decked out. Regardless the way it truly is utilized, jewelers usually are stunned by means of the way persons embraced this hip hop way of life. And so possibly there is not any from the pipeline near to which often purely solely simply just sole can certainly paying for brilliant excellent unfeigned replica chanel bags of which seeing that all right on quite breathtaking charges. This choice to help with excessive dilemma is usually without a doubt, there may be special purely on very best registered conglomeration next to which you may definitely not honorable buy the undoubtedly surprising fantastic straightforward shoes and boots by replica chanel bags although ceremony visit an extraordinary have the funds for exceptionally an incredible offer a good fake hublot significantly better charges. This bracelets manufactured for hoppers will never be elegant. Many people combine having all kinds connected with vogue record, and in addition they commonly also come in substantial sizing's in particular this diamond jewelry.

23. Aug 2014, 14:46 CET | Link

I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. venus factor workout

23. Aug 2014, 14:46 CET | Link
than what

Ctual product packaging and materials may contain more and different information than what is shown on our website. We recommend that you do not rely solely on the information presented and that you always read labels, warnings, and directions before using or consuming a product. venus factor login

23. Aug 2014, 14:47 CET | Link
know how

I have developed an application in seam and richfaces. Anyone please let me know how to change the background color of a page. Instead of white i want a different color. What should i do inorder to accomplish this. venus factor workout

28. Aug 2014, 07:52 CET | Link
coverage, such as

But there are some areas of the page that don't get coverage, such as the form elements and status messages. I figured out a way to stretch the theme across the whole page using RichFaces' theme extensions and some better default styles (unfortunately, the theme extensions only apply to RichFaces projects at this point). how do i naturally get rid of cellulite

01. Sep 2014, 08:19 CET | Link

I am always searching online for articles that can help me. There teeth whitening port saint lucie is obviously a lot to know about this. I think you made some good points in Features also. Keep working, great job!

09. Oct 2014, 10:40 CET | Link

If he does (especially when he releases the new version in 2014), I'll be sure to post here and let everyone to get the girlfriend activation system for free

14. Oct 2014, 10:15 CET | Link
officialworking00 | officialworking00(AT)

I feel really happy to have seen your webpage and look forward to so many more entertaining times reading here. Thanks once more for all the details. Honda

14. Oct 2014, 12:51 CET | Link

The 21 Day Sugar Detox book is only available online through author Diane Sanfilippo's website and is NOT sold through Amazon, Barnes and Noble, or other traditional book sellers.paleo 21 day sugar detox desserts

14. Oct 2014, 18:46 CET | Link
15. Oct 2014, 14:13 CET | Link

Our policy is to provide quality services to the highest local and international standards. We achieve this by maintaining a strong team of skillfully trained professionals that are provided with all the necessary materials to follow local and international procedures in various classifications.Legal Advocates

17. Oct 2014, 15:57 CET | Link

Thank you for serving the information is very helpful. And build hope for the future of bias present information that is more useful and insightful again...... mutelle et medicament

18. Oct 2014, 12:56 CET | Link

You always deliver the best, sir. Whenever, I have read any of your articles, I always had fun. And I rated all of them as high quality. You are one of the best writers that I've read articles of. Sophia1525

20. Oct 2014, 11:44 CET | Link

This is a great article thanks for sharing this informative information. HD mxf files conversion software mxf converter pdf conversion to Office pdf to word

20. Oct 2014, 12:03 CET | Link

This is a great article thanks for sharing this informative information. HD mxf files conversion software mxf converter pdf conversion to Office pdf to word the preview.

21. Nov 2014, 07:57 CET | Link

encourage you to start participating now in these and other issues so that JSF can continue to improve as a result of community participation and feedback. JSF 2 is a big step in the evolution of JSF, but it is by no means the last.

26. Nov 2014, 12:08 CET | Link
eyewearsegment | subhani300(AT)
Would you at any time hear from your refractive make contact with trade? It could be should the particular contact inside of eyes is absolutely taken out merely a procedure and likewise changed using a clean, away from place an actual. This away from place make contact with that’s granted is absolutely customized in direction of private requirements: <a href="">eyewearsegment</a>
18. Dec 2014, 15:01 CET | Link
best uk payday loans

At startup check which java version is running and load the appropriate jdbc classes. The core itself would only work against a common interface shared by the jdbc3 and jdbc4 uk payday loans

19. Dec 2014, 17:22 CET | Link

Thank you for amazing post you shared, I like your writing skill, You are the best, read our traveling blog : Bali Driver Services available in our Bali Tours Services website which is Bali Full Day Tour Packages, Bali Half Day Tour Packages, Bali Combination Tour Packages, Bali Adventure Tour Packages, Bali Transports Tour Services and Bali Round Trip Tour Packages with professional Bali Driver by give you excellent Bali Tour Driver services during your holiday in Bali, click here for : Bali Day Tours Packages Regards Wayan Tomblos