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.
I have a page divided into two sections. One is a list of names of object type X and the other is a form to display the detail of a selected instance.
I have been suffering the same problem as a number of other posts. On the second look at a given instance, the get() never calls the servlet to retrieve possibly updated data.
I have tried all of the recommendations to stop this with no luck.
Here is what I do:
The random number makes the cache mechanism think it is a new request. I have no idea what is doing the caching, but this seems to "disable" it. No gaurentee that I won't get a duplicate random number at some point though. I will keep listening for a better solution.
No, you don't have to do it that way. It's wrong and you shouldn't do it that way. It may, in fact, be contributing to your problem. I did not say to use /servlets or anything like that. I said to use server-relative addressing that starts with the context path.
OK. Read the FAQ and made changes. That did fix one other problem I was having but not this one. I removed the random number and added the header information back in:
But the old response was still held on to. Commented these out and put the random number back in and it works fine.
One other thing about context path. I tried using the two formats in the FAQ in the <%@ include file="" directive and the Eclipse IDE didn't like any of them. I use /dir/file for all of my includes and they seem to work. Am I just getting the syntax wrong? I have so many different syntaxes in my head I would not be surprised if I wasn't getting it right.