Thursday, November 01, 2007

JSF : Redirect to URL with param from navigation-case

I'm evaluating JSF now. I have to admit that some of JSF ideas are pretty nice, but there are many non-intuitive things which make life hard. From another point of view, it is framework, with it's own rules of the game.

From my little experience I could say that JSF doesn't like the way of passing params via GET. Of course it is possible, but I couldn't say it is trivial and easy as in Struts for example. So, here is some technical stuff.

I need to to redirect from navigation-case to URL with param which is a property of a managed bean. It looks like this :

I've tried to figure out how to do it, but had no success here. In fact I found solution, but it's more something like a hack than solution.
So, I've asked MyFaces mailing list. Many thanks to all the people who answered me.

To keep the story short, here is solution. Custom view and navigation handlers should be added to use managed bean property as url param in navigation-case.

I think to myself... should I use core JSF or switch to Apache Orchestra, or JBoss Seam to make development with JSF less painful ? JSF is still young, 1.2 is the latest version of specification and frameworks that use JSF has many additional functionality. Who knows ?


Anonymous said...

Thanks for sharing this information. I'm using JSF as my main web framework and also tried Seam. Finally I decide to stick on core JSF simply because want to make thing simple. Seam is very attractive but I got some trouble (maybe being too inexperience) and cannot make it work correctly on Glassfish.

Stas Ostapenko said...

I'm going to try Seam very soon.

Abe said...


Thanks for posting a solution to this problem.

As a newbie to JSF, how the heck do you configure the two wrapper classes in your web.xml or faces.config. The viewhandler and navigation handler are ok. Do I need to add the wrappers and compile the myfaces source?


Stas Ostapenko said...

Hi Abe !

Just configure view and navigation handelers in your faces-config.xml. Sources, of course, should be compiled, but not entire myfaces. I don't remember exactly, there are something about 4 source files.

Anonymous said...

Thank you very much for the link and sources. Inside faces-config, the following should be added:


And I confirm it does work for JSF 1.1.

Stas Ostapenko said...

Your welcome. Glad to hear that it's still work :)