KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > inversoft > verge > mvc > view > jsp > model > PasswordTag


1 /*
2  * Copyright (c) 2003, Inversoft
3  *
4  * This software is distribuable under the GNU Lesser General Public License.
5  * For more information visit gnu.org.
6  */

7 package com.inversoft.verge.mvc.view.jsp.model;
8
9
10 import javax.servlet.jsp.JspException JavaDoc;
11
12 import com.inversoft.verge.mvc.model.ModelResolution;
13
14
15 /**
16  * <p>
17  * This class represents an HTML password input tag.
18  * </p>
19  *
20  * @author Brian Pontarelli
21  */

22 public class PasswordTag extends com.inversoft.verge.mvc.view.jsp.html.PasswordTag {
23
24     protected ModelResolution modelResolution;
25
26
27     /**
28      * Construsts a new <code>PasswordTag</code>.
29      */

30     public PasswordTag() {
31     }
32
33
34     /**
35      * Initializes the tag by checking that the tag is inside a form tag
36      *
37      * @throws JspException If this tag is not inside a form tag
38      */

39     public void initialize() throws JspException JavaDoc {
40
41         // Initialize the parent reference and the bean reference
42
super.initialize();
43         super.initializeKeyProperty();
44
45         modelResolution = ModelHelper.getModelResolution(key, property, pageContext);
46         if (modelResolution == null) {
47             throw new JspException JavaDoc("Invalid model definition: " + getModel());
48         }
49     }
50
51     /**
52      * Overrides the {@link com.inversoft.verge.mvc.view.jsp.html.PasswordTag
53      * #createPasswordTag(StringBuffer, String, String, Object)
54      * super.createPasswordTag()} method and calculates the value for this
55      * particular password instance.
56      *
57      * @param buf The StringBuffer to append the HTML to
58      * @param value The possible value of this password instance
59      * @throws JspException If there was any problems generating the HTML
60      */

61     protected void createPasswordTag(StringBuffer JavaDoc buf, String JavaDoc id, String JavaDoc name,
62             Object JavaDoc value)
63     throws JspException JavaDoc {
64         if (isGetValue()) {
65             value = ModelHelper.getValue(modelResolution, pageContext);
66         }
67
68         super.createPasswordTag(buf, id, name, value);
69     }
70
71     /**
72      * Outputs the extra model information
73      *
74      * @return Always returns EVAL_PAGE
75      */

76     public int doEndTag() throws JspException JavaDoc {
77         super.doEndTag();
78
79         if (isSetValue()) {
80             ModelHelper.outputModelExtra(modelResolution.getMetaData(), localName,
81                 pageContext);
82         }
83
84         return EVAL_PAGE;
85     }
86 }
Popular Tags