KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > tags > databinding > message > MessageArg


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * $Header:$
17  */

18 package org.apache.beehive.netui.tags.databinding.message;
19
20 import javax.servlet.jsp.JspException JavaDoc;
21 import javax.servlet.jsp.PageContext JavaDoc;
22
23 import org.apache.beehive.netui.tags.AbstractClassicTag;
24
25 /**
26  * <p>
27  * This tag should be used in conjunction with the {@link Message} tag to provide a message argument to the
28  * message format provided in the {@link Message#setValue(Object)} method. Before formatting, the
29  * value of this tag will be substituted into the message.
30  * </p>
31  *
32  * @jsptagref.tagdescription
33  * <p>
34  * This tag should be used in conjunction with the {@link Message} tag to provide a message argument to the
35  * message format provided in the {@link Message#setValue(Object)} method. Before formatting, the
36  * value of this tag will be substituted into the message.
37  * </p>
38  * @example
39  * <p>For an example that uses the &lt;netui-data:messageArg&gt; tag, see the {@link Message} description.
40  * @deprecated This tag has been deprecated in favor of the i18n tags available in JSTL.
41  * @netui:tag name="messageArg"
42  * deprecated="true"
43  * description="Allows you to set values that are used as arguments to the Message tag. The formatted message results are available to the page context."
44  */

45 public class MessageArg
46         extends AbstractClassicTag {
47
48     private Object JavaDoc _value = null;
49
50     public String JavaDoc getTagName() {
51         return "MessageArg";
52     }
53
54     /**
55      * @jsptagref.attributedescription A string value for the argument.
56      * @jsptagref.attributesyntaxvalue <i>string_argument</i>
57      * @netui:attribute required="true" rtexprvalue="true"
58      */

59     public void setValue(Object JavaDoc value) {
60         this._value = value;
61     }
62
63     public int doStartTag()
64             throws JspException JavaDoc {
65         // verify parent tag
66
if(!(getParent() instanceof Message)) {
67             throw new JspException JavaDoc("Invalid Parent");
68         }
69
70         return EVAL_BODY_BUFFERED;
71     }
72
73     public int doEndTag()
74             throws JspException JavaDoc {
75         if(hasErrors())
76             reportErrors();
77         else
78             ((Message)getParent()).addMessageArgument(_value);
79
80         localRelease();
81
82         return EVAL_PAGE;
83     }
84
85     protected void localRelease() {
86         super.localRelease();
87         _value = null;
88     }
89 }
90
Popular Tags