1 7 package org.ejtools.jndi.browser.web.taglib; 8 9 import javax.servlet.ServletContext ; 10 import javax.servlet.jsp.JspException ; 11 import javax.servlet.jsp.tagext.TagSupport ; 12 13 import org.ejtools.jndi.browser.web.Constants; 14 15 25 public class ConnectTag extends TagSupport 26 { 27 28 private String name = Constants.GLOBAL_TREE; 29 30 private String page = "/refresh.do"; 31 32 33 39 public int doEndTag() 40 throws JspException 41 { 42 boolean valid = false; 43 44 ServletContext context = pageContext.getServletContext(); 45 46 if (context.getAttribute(name) != null) 47 { 48 valid = true; 49 } 50 51 if (valid) 53 { 54 return (EVAL_PAGE); 55 } 56 else 57 { 58 try 59 { 60 pageContext.forward(page); 61 } 62 catch (Exception e) 63 { 64 throw new JspException (e.toString()); 65 } 66 return (SKIP_PAGE); 67 } 68 } 69 70 71 77 public int doStartTag() 78 throws JspException 79 { 80 return SKIP_BODY; 81 } 82 83 84 90 public String getName() 91 { 92 return this.name; 93 } 94 95 96 102 public String getPage() 103 { 104 return this.page; 105 } 106 107 108 109 public void release() 110 { 111 super.release(); 112 this.name = Constants.GLOBAL_TREE; 113 this.page = "/refresh.do"; 114 } 115 116 117 122 public void setName(String name) 123 { 124 this.name = name; 125 } 126 127 128 133 public void setPage(String page) 134 { 135 this.page = page; 136 } 137 } 138 | Popular Tags |