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 –>
<mvc:interceptors>
<bean class=”org.springframework.web.servlet.mvc.WebContentInterceptor” p:cacheSeconds=”0″ p:alwaysUseFullPath=”true” >
<property name=”cacheMappings”>
<props>
<!– don’t cache –>
<prop key=”/path/to/ajax/**”>0</prop>
</props>
</property>
</bean>
</mvc:interceptors>
I also needed to add xmlns:p=”http://www.springframework.org/schema/p” to my beans statement since I was not using the p namespace for anything else.