Jakarta RESPONSE Taglib Example


<%@ taglib uri="http://jakarta.apache.org/taglibs/response-1.0" prefix="res" %> <%@ taglib uri="http://jakarta.apache.org/taglibs/request-1.0" prefix="req" %>

Test to see if response output is committed:

   Response is already committed!


   Response is not committed yet.

Add a Cookie using tag attributes and JSP:

   Now add the domain dynamically, any of the attributes except name
   can be added dynamically. The domain is obtained from the JSESSIONID
   cookie if it exists.
   
    
     
    
   

See if the Expires HTTP header exists:

   Expires header already exists!


   Set Expires HTTP Header to 0:
   0

Now see if the Expires HTTP header exists:

   Expires header exists.


   Expires header does not exist.

Test addHeader by adding the Cache-Control header:
   Cache-Control:no-cache
   no-cache
   Cache-Control:no-store
   no-store

Test flushing output buffer:

Now see if response output is committed:

   Response is already committed!


   Response is not committed yet.

Test the encodeUrl tag:
Try the sendredirect.jsp page, it redirects you back to index.html.
Try the senderror.jsp page, it returns back an unathorized error (401).

Test setting the status code for the response to SC_OK:


Test setting the content type to text/html:
text/html