IE and caching AJAX calls in my Spring webapp

When things work fine in Chrome and Firefox but not in IE I am quick at hating MS. Really quick!

In one webapp I have a small widget that allows to decide which columns to show or hide. It does AJAX calls to get the users preferences and to save them when they are modified.

The problem in IE is that it would not get the new preferences as we moved in the webapp. It would keep the original preferences.

If you restart the browser then it would picked the new display preferences. We then configured IE to get new content on every page request and that also “fixed” the issue.

I decided to look to see what configuration I needed to add to my Spring 3.1 app to specify the caching on the AJAX request. I found this answer in Stackoverflow.

From that I basically added this xml to my servlet.xml file:

<!– caching settings for some URIs –>
<bean class=”org.springframework.web.servlet.mvc.WebContentInterceptor” p:cacheSeconds=”0″ p:alwaysUseFullPath=”true” >
<property name=”cacheMappings”>
<!– don’t cache –>
<prop key=”/path/to/ajax/**”>0</prop>

I also needed to add xmlns:p=”; to my beans statement since I was not using the p namespace for anything else.

Published by


Java developper that loves photography and an excellent espresso

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s