You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: jsp-questions.md
+27-1
Original file line number
Diff line number
Diff line change
@@ -436,7 +436,33 @@ The jsp page, by default, always creates a session. Using a directive pagewith a
436
436
## Q. What is the difference between JSPWriter and PrintWriter?
437
437
`PrintWriter` is the object responsible for recording the contents of the response to the request. `JspWriter` uses an object `PrintWriter` to buffer. When the buffer is full or flushed, it `JspWriter`uses the object `PrintWriter` to write the content in response.
438
438
439
-
#### Q. How to disable caching on back button of the browser?
439
+
## Q. How to disable caching on back button of the browser?
440
+
for this, once the session is invalidated, in your respective jsp page add following code snippet
_`token` can be any valid session attribute used for validation_
453
+
454
+
**Cache-Control** : HTTP 1.1 header filed holds directives (in requests and responses) that control caching in browsers and shared chaches eg. proxies , CDNs.
455
+
- no-cache : allows caches to store a response, but requires them to revalidate it before reuse.
456
+
- no-store : any caches of any kind (private or shared) should not store this request and corresponding response.
457
+
- must-revalidate: cache either revalidates the stored response with the origin server, or if that's not possible it generates a 504 (Gateway Timeout) response to prevent reuse of stale responses when they are disconnected from the origin server.
458
+
459
+
**Pragma** : HTTP 1.0 header is an implementation-specific header that may have various effects along the request-response chain to prevent the client from caching the response.
460
+
- no-cache: Forces caches to submit the request to the origin server for validation before a cached copy is released.
461
+
462
+
**Expires**: HTTP header contains the date/time after which the response is considered expired.
463
+
- Invalid expiration dates with value 0 represent a date in the past and mean that the resource is already expired.
464
+
-`setDateHeader()` used in case to prevent caching on proxy servers
465
+
440
466
#### Q. What are the different tags provided in JSTL?
441
467
#### Q. How is JSP better than Servlet technology?
442
468
#### Q. What are the differences between include directive and include action?
0 commit comments