aspose file tools*
The moose likes JSF and the fly likes URLs always one step behind Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "URLs always one step behind" Watch "URLs always one step behind" New topic
Author

URLs always one step behind

Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2854
    
  11

This may be a stupid question, but I'm working with a JSF application and I'm seeing the URL that appears in the browser's navigation bar is always for the page I just left, rather than the page I'm on. Is that expected, or does it indicate something funny going on with the navigation? Functionally, the application seems to be fine. It displays the right content for the page, just the wrong URL. Even the document.location in the DOM has the URL of the previous page.
Cesar Loachamin
Ranch Hand

Joined: Dec 25, 2010
Posts: 90

Hi Greg

That's the way that JSF works, in this post http://www.coderanch.com/t/522508/JSF/java/commandButton-URL-no-refresh you find a explanation of why it works so by Tim Holloway , and I post a example of use the redirect to correct the url.

Regards

Cesar


When a dream is ending because to come true - OCPJP 6,7. OCE JPA EE6. MCTS
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2854
    
  11

Thanks Cesar! I'm a bit embarrassed though that my question was already answered less than two weeks ago on this very site, and somehow and I couldn't find it. Anyway, I appreciate the pointer.
Cesar Loachamin
Ranch Hand

Joined: Dec 25, 2010
Posts: 90

Do not worry Greg, the earlier publication did not have the title clear reference to your question
Brendan Healey
Ranch Hand

Joined: May 12, 2009
Posts: 218
It's worth pointing out that if you use faces-redirect=true this introduces significant complications
regarding the passing of data between pages. For example if you select a department on page 1
to display a list of employees on page 2, you need to pass some sort of reference to the dept
between the pages. As the redirect results in a new request you end up having to store things
in the session map, flash "scope" (which I have have little success with) or use view parameters,
or CDI conversation scope.

When you throw ajax into the equation it gets even worse (until you switch from request to view
scope). These are things worth factoring into any design considerations, and a little prototyping
could save considerable amounts of heartache in the future.

Regards,
Brendan.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: URLs always one step behind