This post originated from an RSS feed registered with Agile Buzz
by Dominik Wei-Fieg.
Original Post: How to make JSF navigation rules more dynamic
Feed Title: Ars Subtilior
Feed URL: http://typo.ars-subtilior.com/articles.rss
Feed Description: Finest Handmade Code
Random thoughts about agile software development as an art
You do a post request from some form in an JSF application and want to decide on the page to redirect to dynamically. No problem, just use different “navigation-case” entries and go to different “to-view-id”s depending on the “from-outcome”.
I have done a System.out on the result variable before: return super.getActionURL(context, result);
It seems as if facelets/myfaces or something reloads the page one more time without the paramters:
The output gives me this:
----- 8<---- result=/result.jsf?function=foo&result=100 result=/result.xhtml ------ -------- I can't figure out why though... anyone that can help?
int queryStart = value.indexOf("?"); if((queryStart > 0) && (result.indexOf("?") == -1)) { result = result + value.substring(queryStart); } return result; at the end of getActionUrl, which you seem not to have. I think it should solve your problem. Regards Wojtek
Hello Dominik. I've tried it and it works cute. But what about situation, when we return null from backing bean method (there is no navigation used and page is re-rendered), and we'd like to keep request parameter for that page. I need it for my jsp-jsf application and I'd very grateful for any your suggestion:)