Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

forwarding after response has been committed  RSS feed

 
Daniel Prene
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to redirect from the backing bean and bypass the jsf-config?
Heres what I want to work:

When I try it I get "Can't forward after response has been committed"


I need to stick to the front controller pattern... Is this possible? This is currently my system:

front controller creates a viewassistant and checks its roles against that of the user, viewassistant creates backing bean and returns name of proper jsf page, front controller forwards to jsf page. All direct access to JSP pages is blocked. I need to keep this model... is this possible using jsf? I am extreamly opposed to switching to struts and would like to stay with jsf.

I'm almost there, everything works BUT the redirection from backing bean. I also prefer (unless absolutely needed) to add a new entry to faces-config.xml everytime I add a page... unless it is possible to dynamicaly pass parameters to navigation rules. For example: I'd be able to return fc?view=userProfile&userId=1345345 ... that's not a real example, but it clarifies my point.

Thank you for atleast reading this.
-D.P.
 
Daniel Prene
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Found a hack!





It probably breaks other functionality but... I really don't care!
 
Amrish
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Daniel,

Did you get this to works. Based on your code for the NavigationHandler above, the redirect will not work. The "outcome" passed to the handler is not a page name so the redirect will fail.

Is there a way to get the to-view-id based on a given from-view-id and outcome?
 
Daniel Prene
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It works. I just pass the URI from the backing bean.
 
Daniel Prene
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a matter of needing to "facesContext.responseComplete();" after redirection takes place.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!