01: /**
02: * $Id: BaseTagSupport.java,v 1.2 2002/06/01 22:16:15 sorensen Exp $
03: * Copyright 2002 Sun Microsystems, Inc. All
04: * rights reserved. Use of this product is subject
05: * to license terms. Federal Acquisitions:
06: * Commercial Software -- Government Users
07: * Subject to Standard License Terms and
08: * Conditions.
09: *
10: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
11: * are trademarks or registered trademarks of Sun Microsystems,
12: * Inc. in the United States and other countries.
13: */package com.sun.portal.wireless.taglibs.base;
14:
15: import javax.servlet.*;
16: import javax.servlet.http.*;
17: import javax.servlet.jsp.*;
18: import javax.servlet.jsp.tagext.*;
19:
20: /**
21: * BaseTagSupport base class for tag libraries
22: *
23: * Support for "name" attribute via name field
24: * and getName() & setName() methods.
25: * Normally used in conjunction with "id"
26: * attribute found in JSP's TagSupport class
27: *
28: * Support for evaluating attributes using
29: * a request parameter; see evalAttribute().
30: *
31: * @author Robert O'Brien
32: * @version 1.0
33: * @see javax.servlet.jsp.tagext.TagSupport
34: */
35: public abstract class BaseTagSupport extends
36: javax.servlet.jsp.tagext.TagSupport {
37:
38: /**
39: * Name of referenced object
40: */
41: protected String name;
42:
43: /**
44: * Get name of referenced object
45: *
46: * @return name of referenced object
47: */
48: public String getName() {
49: return name;
50: }
51:
52: /**
53: * Set name of referenced object
54: *
55: * @param name name of referenced object
56: */
57: public void setName(String name) {
58: this .name = name;
59: }
60:
61: /**
62: * Expands a tag attribute value using the
63: * request parameter specified
64: *
65: * If the attribute is of the form $(p)
66: * then the request parameter named "p" will
67: * be used.
68: *
69: * If the attribute value is of the form $[c:k]
70: * then the message catalog "c" will get used to
71: * get the message using key "k".
72: *
73: * Otherwise the value is returned unchanged.
74: *
75: * @param attribute the attribute value
76: * @return the evaluated attribute value
77: */
78: public String evalAttribute(String attribute) {
79: return Util.evalAttribute(pageContext, attribute);
80: }
81:
82: /**
83: * Cleanup
84: */
85: public void release() {
86: id = null;
87: name = null;
88: }
89: }
|