• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Village Idiot
Posts: 484
jQuery Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?

 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
I have always wanted to have a neighbor just like you - Fred Rogers. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic