Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trying to redirect from page user has clicked on to another (might be able to use nav rule?)

 
Matt Kohanek
Village Idiot
Ranch Hand
Posts: 484
Java jQuery Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Let's say a user gets an email with a url. I need that url to send the user to a page that triggers some java backing bean action, and regardless of that out come, the user is then redirected to another page.

I have the logic in place to send the user to the page in the email (user clicking the link I suppose...) and do the backing bean actions (<h:form id="Form" name="Form" class="Form" binding="#{InitBean.form}"> ), but I am not sure what is best to use to then send the user to another url once the actions have been triggered in the Init bean.

I was considering something like this:




Will this do what I need (I cannot test it just yet, waiting for deploys so I do not want to mess with checked in code)?
And even if it will, is this the best way to accomplish this?

 
Tim Holloway
Saloon Keeper
Pie
Posts: 18020
47
Android Eclipse IDE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSF navigation is used when a JSF view has fired off an action and the action then wishes to tell JSF what JSF view to present as a response. Which in and of itself isn't actually a "redirect".

Navigation only applies to JSF views, however, so if you want the response to be rendered from non-JSF resources such as servlets, JSPs, or even plain old HTML, you will have to do a true redirect. There's no simple JSF method for that, so you have to do it the hard way: get the FacesContext, use it to obtain the raw J2EE components, then do a traditional redirect using them.

More commonly, I present a JSF response view that contains a link that references whatever non-JSF function I need, since usually I'm doing something that includes user interaction in the process.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic