KickJava   Java API By Example, From Geeks To Geeks.

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

24 public class SubmitTag extends com.inversoft.verge.mvc.view.jsp.html.SubmitTag {
25
26     /**
27      * This classes logger
28      */

29     private static final Logger logger = Logger.getLogger(SubmitTag.class);
30
31
32     /**
33      * Initializes the tag by checking that the tag is inside a form tag
34      *
35      * @throws JspException If this tag is not inside a form tag
36      */

37     public void initialize() throws JspException JavaDoc {
38
39         // Initialize the parent reference and the bean reference
40
super.initialize();
41
42         FormTag form = FormHelper.getFormTag(super.getFormParent());
43         ActionConfig actionConfig = form.getConfig().getActionConfig(localAction);
44         if (actionConfig == null) {
45             logger.error("Invalid action: " + getAction() + " for form: " +
46                 form.getConfig().getName());
47             throw new JspException JavaDoc("Invalid action: " + getAction() + " for form: " +
48                 form.getConfig().getName());
49         }
50     }
51
52     /**
53      * Outputs the extra model information
54      *
55      * @return Always returns EVAL_PAGE
56      */

57     public int doEndTag() throws JspException JavaDoc {
58         super.doEndTag();
59         FormHelper.outputControllerExtra(localName, localAction, pageContext);
60         return EVAL_PAGE;
61     }
62 }
Popular Tags