I agree with Mike - personal questions are best asked by e-mail. And, to be perfectly honest, I tend to ignore e-mailed questions unless I understand why they haven't been posted in a forum.
But enough of that. The difference between forwarding and redirecting is this. Forwarding is completely internal to the server; it's a way for one
servlet to call another servlet. A redirect sends a response back to the browser telling it to retrieve the given URL. In practical terms, this means
- A redirect will show up in the browser's address bar, a forward won't as the client is as unaware of the forwarding process as of any other Java method call.
- In a forward, request attributes are preserved; in a redirect, they aren't as a redirect tells the browser to send a completely new request.
- A forward is generally more efficient than a redirect.
- A forward can only go to another resource running on the same server; a redirect can tell the browser to go absolutely anywhere.
Protecting your page from caching is notoriously hard. Formally, it should simply be a matter of setting the "Pragma" response header to "no-cache" (for HTTP/1.0 clients) and the "Cache-Control" header to "no-cache" (HTTP/1.1 clients). But in practice this is ignored by buggy proxy implementations (one Bill G. is the major culprit here - surprise, surprise - small wonder: if there's one company you can trust to ***** up whatever they do...). Even setting the "Expires" header to "0" is not completely Bill--- I mean fool-proof. A workaround is to generate a unique parameter (e.g. timestamp) for every request. There is another workaround that is supposed to be bomb-proof, something to do with sending back error response codes, but I lost track of it. Anyone?
Read RFC 2616 to learn more about HTTP headers.
HTH
- Peter
[This message has been edited by Peter den Haan (edited November 03, 2001).]