It's not a secret anymore!*
The moose likes Spring and the fly likes Resources - Javascript file strange behavior!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Resources - Javascript file strange behavior!!!" Watch "Resources - Javascript file strange behavior!!!" New topic
Author

Resources - Javascript file strange behavior!!!

Cj Recto
Greenhorn

Joined: Mar 02, 2012
Posts: 26
Hellow guys, I'm having a problem regarding with my javascript files in my spring web project.

I wonder what's wrong with this, but my external javascript file doesn't reflect the changes I made to it when I run the program.
What I do is I need to rename the file so that the changes would take effect.

When I close eclipse and open it again, then the changes would not be reflect again. Then I need to rename the javascript file again.

It seemed that it retains the previous code it has everytime I close and open my eclipse.

I'm lost guys, have you experienced this problem?

Any help would be appreciated!

Thanks in advance!


heres the part of my dispatcher servlet


and here's my html file code :
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1672
    
    7

I may be misunderstanding but it sounds like to me that your browser is caching your javascript. Changing the name is forcing the browser to reload it.


[How To Ask Questions][Read before you PM me]
Cj Recto
Greenhorn

Joined: Mar 02, 2012
Posts: 26
Ok, thanks for that answer, I think that's the problem, I'm currently working on it! Thanks!
Cj Recto
Greenhorn

Joined: Mar 02, 2012
Posts: 26
I thinks I found the solution, let me post it here just incase anyone would experience the same problem.

in your mvc resources configuration, set cache-period="0" so it will prevent resources files from being cached.

I found it here:

prevent spring mvc resources from being cached

 
jQuery in Action, 2nd edition
 
subject: Resources - Javascript file strange behavior!!!