• 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

URLs always one step behind

 
Sheriff
Posts: 3063
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 90
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Greg

That's the way that JSF works, in this post https://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: 3063
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do not worry Greg, the earlier publication did not have the title clear reference to your question
 
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic