• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

URLs always one step behind

 
Greg Charles
Sheriff
Posts: 2993
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 90
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
Greg Charles
Sheriff
Posts: 2993
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 90
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do not worry Greg, the earlier publication did not have the title clear reference to your question
 
Brendan Healey
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic