I am using Struts1.2 framework. On logout I call LoginAction which invalidate session. The problem is browser's back button problem as users information remains. I have read posts related to this which mentions setting headers in response object like Cache-Control,Expires and Pragma. But I have lots of jsp pages, so do I need to include part of setting response header in all jsp pages? Is there any better option to do this at one place? Also I tried setting "controller" tag in Struts-Config.xml where "noCache" can be specified but there are some static jsp pages for which there is no action written and these are called directly using anchor tag, so facing same back button problem for these pages. Do I need to change calling of static jsp pages? I want central point to control this, dont want to set response headers on each jsp page. How do I solve this?
It looks like you've already explored most of the options that are available to you. In my opinion, setting "noCache" in the controller stanza of the struts-config.xml file is the best option in spite of the drawback you mentioned. One possible workaround for the static pages is to have them served directly from your HTTP Server. In a typical production installation, there is an HTTP Server up front which forwards to the Application server. You could simply keep all your static content in the HTTP Server's context.
You could simply keep all your static content in the HTTP Server's context.
What do you mean by this? I am using Apache tomcat5 server and back end as MySQL db. Do you mean the call to static pages has to undergo via struts-config.xml i.e. there might be some forward to call these pages? Or anything else? Please explore.
Joined: Feb 15, 2005
I'm used to working with IBM's WebSphere Application Server. In the topology most often used there is a separate Apache HTTP Server that in turn forwards requests to the application server. This Apache Server can serve static pages without forwarding to the app server. It would be set up so that any URI with a suffix of ".do" or ".jsp" gets forwarded to the app server, but other requests would be served from the static server. You would then set up a folder in the HTTP Server's context with the same name as your Struts application. That way the page http://myserver.com/myApp/mystaticPage.html would be served from the HTTP Server and the page http://myserver.com/myApp/mydynamicpage.jsp would be served from the app server. You could then easily use the static page URL as a forward in your Struts application. If you did this, the Struts "noCache" directive would not apply to the static pages.
I believe you could set up such a topology with Tomcat, but I'm afraid I don't know the details of how to do it. [ April 21, 2008: Message edited by: Merrill Higginson ]