• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF page dynamic navigation on View page source of browser shows previous page html components.

 
Atif Satti
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have simple JSF application i load JSF page dynamically every thing works fine when i navigate through the pages but when i navigate from page 1 to page 2 content of page 2 are updated but when i view page source from browser it shows the html tags of previous page. i am using JSF 2 + primefaces and spring.
 
Tim Holloway
Bartender
Posts: 18408
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Atif!

Some browsers have a questionable way to "show page source". Instead of displaying the current page source, they resend the URL and display what came back. My guess is that the original HTML was discarded by the client when the page DOM was built, so that's the only way to get the exact source of the page. More or less. Changes to the server context between fetches might actually result in something not quite the same.

The problem with doing that in JSF is that JSF URLs are more like "handles" than they are like absolute resource locators, as you can see when you navigate from one page to another but the displayed URL in the navigation bar hasn't changed. So when the URL is fetched directly, the navigational context is lost and the original page is re-fetched.

You can get around that by using the "redirect" option on your navigation, although there is some additional overhead when you do that.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!