tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yun Sang Jung" <>
Subject Could you advice me to correct my custom tag code?
Date Wed, 02 Aug 2000 00:22:10 GMT

I implemented my first nocache tag. There is no error in compile and run time.
But my code seems not to work properly. If there is taglib code guru, please tell me
how to correct my code..


[my Code]
import javax.servlet.http.*;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.Tag;
import javax.servlet.jsp.tagext.TagSupport;


public class NoCacheTag extends TagSupport {
 public int doStartTag() throws JspException {
  return SKIP_BODY;
 public int doEndTag() throws JspException {
  HttpServletRequest req = (HttpServletRequest) pageContext.getRequest();
  HttpServletResponse res = (HttpServletResponse) pageContext.getResponse();

  if(req.getProtocol().compareTo ("HTTP/1.0") == 0) {
   res.setHeader ("Pragma", "no-cache");
  } else if (req.getProtocol().compareTo ("HTTP/1.1") == 0) {
   res.setHeader ("Cache-Control", "no-cache");
  res.setDateHeader ("Expires", 0);
  return EVAL_PAGE;
View raw message