This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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

JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Resources - Javascript file strange behavior!!!" Watch "Resources - Javascript file strange behavior!!!" New topic

Resources - Javascript file strange behavior!!!

Cj Recto

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

Joined: Mar 07, 2010
Posts: 1682

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

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

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

I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Resources - Javascript file strange behavior!!!
It's not a secret anymore!