• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JavaScript section in JSP Page

 
Kim Kantola
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I have a Javascript section in my JSP page as follows:


What I am confused about is, if I navigate away from this page, and then navigate back to it, it does not appear as if this section of code is re-evaluated the second time I visit the page. Is this correct? How would I make it be evaluated? I need to because the value of qList and thus the value of quarters should change between the page visits.

Thanks very much for any info!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if I navigate away from this page, and then navigate back to it


By that do you mean using the Back button? Or navigating back to the page through links?

I'm assuming the former. And in this case, the Javascript will be re-evaluated, but not the JSP code. Think about it for a minute. When you hit the Back button you are telling the browser to show the page again out of its cache. So all that's happening is that the orginal page that was sent is being re-displayed. No server. No JSP.
 
Kim Kantola
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am navigating to the page through links, the first time I visit the page, I click a link which brings me to a differant page, then I click a submit button on that page which brings me back to the origional jsp.

It appears that the html for the page is being correctly redrawn, but the values set in the javascript are not being refreshed.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, that's a bit different, but perhaps not too much.

It may be the case that when you navigate back to the page, the browser is pulling the old page out of cache. First step is to check whether the browser is actually going back to the server and re-executing the JSP page.

A simple way to check this could be to add some log statements to the JSP code and check whether they get written the second time the page is hit.
[ November 03, 2004: Message edited by: Bear Bibeault ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic