1 16 package org.apache.taglibs.dbtags.connection; 17 18 import javax.servlet.jsp.JspTagException ; 19 import javax.servlet.jsp.tagext.BodyTagSupport ; 20 21 51 public class UserIdTag extends BodyTagSupport { 52 53 private String _userId = null; 54 55 60 public void setInitParameter(String paramName) { 61 _userId = pageContext.getServletContext().getInitParameter(paramName); 62 } 63 64 public int doEndTag() throws JspTagException { 65 try { 66 ConnectionTag connTag = 67 (ConnectionTag) findAncestorWithClass(this, Class.forName("org.apache.taglibs.dbtags.connection.ConnectionTag")); 68 69 if (_userId == null) { 70 _userId = getBodyContent().getString().trim(); 71 } 72 73 connTag.setUserId(_userId); 74 } 75 catch (ClassNotFoundException e) { 76 throw new JspTagException (e.toString()); 77 } 78 return EVAL_PAGE; 79 } 80 81 public void release() { 82 _userId = null; 83 } 84 85 } 86 | Popular Tags |