0

I have a simple jsf/primefaces application:

  • When the user logs in, he has to select which order he works on - this order object is set into a SessionScoped bean
  • Later, when the user navigates to any other pages (e.g. handleOrder.xhtml), the sessionScoped bean is queried to get the current order

My problem is, how to handle those situations, when:

  • the user logs in,
  • but doesn't select an order object
  • but instead manually enters the url: handleOrder.xhtml?

My question is the following: is there a way to define a "global" navigation rule in faces-config, which says something like "if there is no open order redirect to listDeals.xhtml"? Or is there a way to identify if a navigation takes place by using a GUI element or if by entering a URL manually?

Thanks, krisy

krisy
  • 1,508
  • 1
  • 14
  • 32
  • You've there by the way a design error in bean scope and navigation. For guidelines, check http://stackoverflow.com/q/7031885 and http://stackoverflow.com/q/15521451 – BalusC Jun 03 '15 at 12:33
  • Thank you for your answer! I've read the post about the solution with f:view - but is there a way to handle this inside faces-config, e.g. conditional rules? Or how to identify, if a page is loaded by a jsf navigation, or by the user entering a url manually? – krisy Jun 03 '15 at 12:36
  • `f:viewAction` does that. If you're not on JSF 2.2 yet, then there's no way. – BalusC Jun 03 '15 at 12:48

0 Answers0