JSF 2: ProjectStage only half-baked

In JSF2 there are tons of new and interesting features. Some are big changes and some are really neat small additional things, like the ProjectStage Enum.

Especially for tool-vendors (and component libraries) this is useful to specify the “runtime”. (Development vs. Production vs. SystemTest vs. UnitTest). One example could be the Trinidad Skinning facility. Currently by default we do compression of the generated CSS selectors, but that is a PITA for debugging (even with firebug). However, there is a way around it. Specify the following in your web.xml:




Now… with the upcoming JSF2 ProjectStage Enum, we could easily change the Skinning facility to leverage the different possible values. Production, for instance, means compression is on, Development means there is no compression, etc.

However… this means the developer always has to change the WEB.XML (or do some JNDI setup); same is true for Trinidad’s skinning today ๐Ÿ˜‰ The big problem with the ProjectStage is that the JSF spec only talks about web.xml and JNDI for doing the setup configuration. It would be very cool if the specification would be changed to actually allow system props, since that makes our life easier!

One could easily launch a Trinidad application and on the commandline you specify the actual “project stage”:

mvn jetty:run -Djavax.faces.PROJECT_STAGE=Development

That would be great!


I filed a bug against the spec for this topic.



Posted in jsf, myfaces, trinidad
8 comments on “JSF 2: ProjectStage only half-baked
  1. baranda says:

    That would be great indeed. If the spec does not include it, we can always add this in myfaces in the meanwhile ๐Ÿ˜‰

  2. matthiaswessendorf says:


    that is true. I thought so, but want to make sure life is easy for all of us… ๐Ÿ™‚

    It is somewhat funny that some (“old school”) is mostly overlooked by almost all Java EE related configurations. Instead … we just the extreme cool XML syntax…

    Awesome! ๐Ÿ˜‰

  3. struberg says:

    At least your suggestion made it into MyFaces-2.0.0 ๐Ÿ˜‰

    In MyFaces one can use the system property



  4. matthiaswessendorf says:

    Guess who did that for MyFaces ๐Ÿ˜‰

  5. Werner Keil says:

    I’m pretty sure, that system property only accepts the values of the enum or is that more flexible?

  6. struberg says:

    Hi Werner!

    Take a look at Apache MyFaces CODI ProjectStage if you like to have it more flexible.
    It uses an extensible mechanism based on the ServiceLoader mechanism.



  7. Just took a brief look, but it sounds interesting. We used similar (the general idea is described in books by people like Josh Bloch for quite a while ๐Ÿ˜‰ Interface on top of a concrete implementation (could be an Enum, too) pattern in a PageFlow equivalent under Eclipse RCP, or for the most recent Unit-API implementation at BT.
    Would be cool, if that could make it into CDI 1.1 and used across Java EE 7.

  8. struberg says:

    Please feel free to create a JavaEE-7 issue for it – you are the man for it ๐Ÿ™‚

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: