• 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

Facelets: Clicking on a command link is displaying the URL of the previous request that was sent

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

This is the scenario:

A facelet has a command link (part of a menu bar). When this link is clicked the URL in the address bar is not changing to the URL that is being requested. It is displaying the URL that was requested previously.

Clicking on the same link again changes the URL to what is being requested now.

The idea is to use the URL in a filter to perform authorization. As the URL is not the current one, this will lead to inconsistent results.

What needs to be done to ensure that the current URL gets displayed in the address bar (and not the previous one)?

Thanks,
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is the current URL. However, JSF is primarily based on form postbacks. The URL is more in the nature of a session handle than it is a page locator the way it is in most web frameworks.

To update the URL to indicate the name of the current View, use the "redirect" option on your page navigation. In faces-config, it's just a simple element in the navigation ruleset with no body or attributes like so: <redirect/>

Observe caution, however. It takes more than just this if you expect to produce URLs that can be bookmarked!
 
Praison Selvaraj
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you, Tim.

One question I have is, will the redirect mean that a redirect request will be sent to the browser?

If that is the case, then it would become an overhead....

Cheers,
Praison
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic