KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > inversoft > verge > mvc > view > jsp > actionflow > SubmitTag


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.actionflow;
8
9
10 import javax.servlet.jsp.JspException JavaDoc;
11
12 import com.inversoft.verge.mvc.controller.actionflow.ActionFlowMetaData;
13 import com.inversoft.verge.mvc.view.jsp.JspTools;
14
15
16 /**
17  * This class generates a simple submit tag. This tag must
18  * be embedded in a form tag (custom form tag in this
19  * package).
20  *
21  * @author Brian Pontarelli
22  */

23 public class SubmitTag extends com.inversoft.verge.mvc.view.jsp.html.SubmitTag {
24
25     private ActionFlowMetaData metaData;
26     private String JavaDoc entry;
27     protected String JavaDoc localEntry;
28     private boolean modelEnabled = true;
29     private boolean validationEnabled = true;
30
31
32     /**
33      * Retrieves the tag's entry attribute
34      *
35      * @return Returns the tag's entry attribute
36      */

37     public String JavaDoc getEntry() {
38         return entry;
39     }
40
41     /**
42      * Populates the tag's entry attribute
43      *
44      * @param entry The value of the tag's entry attribute
45      */

46     public void setEntry(String JavaDoc entry) {
47         this.entry = entry;
48     }
49
50     /**
51      * Returns whether or not the model is enabled for this request.
52      *
53      * @return True if the model is enabled, false otherwise
54      */

55     public boolean isModelEnabled() {
56         return modelEnabled;
57     }
58
59     /**
60      * Sets whether or not the model is enabled for this request.
61      *
62      * @param modelEnabled True if the model is enabled, false otherwise
63      */

64     public void setModelEnabled(boolean modelEnabled) {
65         this.modelEnabled = modelEnabled;
66     }
67
68     /**
69      * Returns whether or not validation of the model is enabled for this request.
70      *
71      * @return True if validation is enabled, false otherwise
72      */

73     public boolean isValidationEnabled() {
74         return validationEnabled;
75     }
76
77     /**
78      * Sets whether or not validation of the model is enabled for this request.
79      *
80      * @param validationEnabled True if validation is enabled, false otherwise
81      */

82     public void setValidationEnabled(boolean validationEnabled) {
83         this.validationEnabled = validationEnabled;
84     }
85
86     /**
87      * Expands any of the attributes that require it.
88      *
89      * @throws JspException If this tag is not inside a submit tag and the submit
90      * tag is not inside a form tag, or if a property name was not specified
91      */

92     public void initialize() throws JspException JavaDoc {
93
94         // Initialize the parent reference and the bean reference
95
super.initialize();
96
97         localEntry = entry;
98
99         if (!JspTools.JSP_20) {
100             localEntry = (String JavaDoc) JspTools.expand("entry", entry, String JavaDoc.class,
101                 this, pageContext);
102         }
103
104         String JavaDoc ns = ((FormTag) getFormParent()).localNamespace;
105         String JavaDoc form = ((FormTag) getFormParent()).localForm;
106         metaData = new ActionFlowMetaData(ns, form, localEntry, localAction, null);
107         metaData.setModelEnabled(modelEnabled);
108         metaData.setValidationEnabled(validationEnabled);
109     }
110
111     /**
112      * Outputs the extra model information
113      *
114      * @return Always returns EVAL_PAGE
115      */

116     public int doEndTag() throws JspException JavaDoc {
117         super.doEndTag();
118
119         ActionFlowHelper.outputControllerExtra(localName, localAction, pageContext,
120             metaData);
121
122         return EVAL_PAGE;
123     }
124 }
Popular Tags