KickJava   Java API By Example, From Geeks To Geeks.

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


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  * This class is a basic hidden input tag for use in a jsp
17  * page. It creates an HTML hidden input tag. This tag can
18  * be used to set values to model objects on form submission.
19  *
20  * @author Brian Pontarelli
21  */

22 public class HiddenTag extends com.inversoft.verge.mvc.view.jsp.html.HiddenTag {
23
24     protected ModelResolution modelResolution;
25
26
27     /**
28      * Initializes the tag by checking that the tag is inside a form tag
29      *
30      * @throws JspException If this tag is not inside a form tag
31      */

32     public void initialize() throws JspException JavaDoc {
33
34         // Initialize the parent reference
35
super.initialize();
36         super.initializeKeyProperty();
37
38         modelResolution = ModelHelper.getModelResolution(key, property, pageContext);
39         if (modelResolution == null) {
40             throw new JspException JavaDoc("Invalid model definition: " + getModel());
41         }
42     }
43
44     /**
45      * Outputs the extra model information
46      *
47      * @return Always returns EVAL_PAGE
48      */

49     public int doEndTag() throws JspException JavaDoc {
50         super.doEndTag();
51         if (isSetValue()) {
52             ModelHelper.outputModelExtra(modelResolution.getMetaData(), localName,
53                 pageContext);
54         }
55
56         return EVAL_PAGE;
57     }
58 }
Popular Tags