File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

js not refreshed?

 
Hengki Widjaja
Ranch Hand
Posts: 44
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an external jsfile which only has 2 simple functions:


It all went well, until I edit the function go(). I simply omit that function, restart the apache, but the message "go" still appears. Is the js file cached and somehow not refreshed even after apache restarts? thanks
 
Rajkamal Pillai
Ranch Hand
Posts: 445
1
Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

You might want to clear your browser cache and also set the browser to reload the page from the server and not from its cache.
 
Hengki Widjaja
Ranch Hand
Posts: 44
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to do the settings programmatically? It's not always possible for the client to remember this. Or even better, is there anyway that the container compare the requested js and see if the js file has been updated. if it's updated, then resend the js to browser, if not, let the browser load from cache. thanks
 
Rajkamal Pillai
Ranch Hand
Posts: 445
1
Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I doubt the possibility.

All of that is about how the client browser loads the page. One approach I can think of is to set the JSP headers:



Raj.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Except that, of course, Java code should never be put into a JSP written after 2001. And how would that help with the JS file in any case?

If headers are to be added to the response, it should be done in a filter.
 
Rajkamal Pillai
Ranch Hand
Posts: 445
1
Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I was talking about setting the Response headers from Java code (Servlet/Action).

Raj.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Raj Kamal wrote:I was talking about setting the Response headers from Java code (Servlet/Action).

You said "JSP headers" and showed JSP syntax. Besides, doing this in a servlet or action also won't affect the JavaScript response.
 
Rajkamal Pillai
Ranch Hand
Posts: 445
1
Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bear,

Well thanks for bringing that to my notice. In a hurry to post a reply I guess it slipped through. Apologies....

Now from JSP or from Servlet/Action when I set 'no-cache' and 'Expires' it would mean that the client browser would recognize that the page needs to be loaded from the server and not from the cache, correct? And my understanding is that using both of these would enforce a server call for rendering the page. (A server call would mean that all resources associated with the page - including scripts - would be reloaded.)

I might learn something here so please be kind enough to correct in case I am wrong.

Raj.
 
Rajkamal Pillai
Ranch Hand
Posts: 445
1
Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Removed duplicate post.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whether the page is cached or not has nothing to do with whether the images and other resources in the page are cached or not.
 
Rajkamal Pillai
Ranch Hand
Posts: 445
1
Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So a Request to the server does not mean that all resources associated with the page should also be reloaded? The resources could be loaded from the browser cache. Is that what you meant?

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you do not want it cached, have your build script append a build number to the query string if the files. The query string means nothing and it will force the browser to fetch the new copy.

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic