1 2 package test.web; 3 4 import javax.servlet.http.HttpServletRequest ; 5 import javax.servlet.jsp.JspTagException ; 6 import javax.servlet.jsp.JspWriter ; 7 import javax.servlet.jsp.tagext.TagSupport ; 8 import java.io.IOException ; 9 10 20 public class SimpleTag extends TagSupport { 21 private String action = null; 22 23 31 public String getAction() { 32 return this.action; 33 } 34 35 37 public void setAction(String action) { 38 this.action = action; 39 } 40 41 42 public int doStartTag() throws JspTagException { 43 HttpServletRequest request = (HttpServletRequest ) pageContext.getRequest(); 44 45 try { 46 JspWriter out = pageContext.getOut(); 47 48 out.print("Simple tag started."); 49 } 50 catch (IOException ioe) { 51 ioe.printStackTrace(); 52 } 53 54 return EVAL_BODY_INCLUDE; 55 } 56 57 58 public int doEndTag() { 59 try { 60 JspWriter out = pageContext.getOut(); 61 62 out.print("Simple tag ended."); 63 } 64 catch (IOException ioe) { 65 ioe.printStackTrace(); 66 } 67 68 return EVAL_PAGE; 69 } 70 } | Popular Tags |