Jason Stranger
|
I have written some JSP code on template JSP to update the page hits count when the page is accessed. The code is ok on offline mode, but when I check it on online mode, the count does not get update. May I know where I should my JSP so that it will be execute everytime? | |
Flo Advanced Member Joined: May 7, 2004 Posts: 452 Status: Offline |
Hi, what exactky are you doing in your jsp? Are you writing to the VFS? If yes, you have to switch to the Offline project first and publish the modified resource afterwards. This can be done using methods in CmsRequestContext and CmsPublishManager ---------------------------------------- /** * Florian Hopf * Synyx GmbH & Co. KG */ | |
Jason Stranger
|
I use the OAMP Counter Module in my JSP. It will save the count to database. The following is the code snippet: String uri = cms.getRequest().getParameter("uri") == null ? cms.getRequestContext().getUri() : cms.getRequest().getParameter("uri"); int pageCount = getCounterManager().incrementCounter(uri); out.println("count = " + pageCount); On offline mode, everytime I refresh the page, my count increase one. But on online mode, the page count I get remain the same. Seems the page is cached and JSP code snippet does not get executed. | |
Flo Advanced Member Joined: May 7, 2004 Posts: 452 Status: Offline |
Yeah, caching might be the reason. Try to set the cache property for the elements displaying and writing the hit to "never" ---------------------------------------- /** * Florian Hopf * Synyx GmbH & Co. KG */ | |
Jason Stranger
|
Yes, it does work if I set cache from "uri;element" to "never". | |