KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ofbiz > webapp > taglib > I18nMessageArgumentTag


1 /*
2  * $Id: I18nMessageArgumentTag.java 5462 2005-08-05 18:35:48Z jonesde $
3  *
4  * Copyright (c) 2002-2003 The Open For Business Project - www.ofbiz.org
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included
14  * in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
21  * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
22  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  *
24  */

25 package org.ofbiz.webapp.taglib;
26
27 import javax.servlet.jsp.JspException JavaDoc;
28 import javax.servlet.jsp.tagext.TagSupport JavaDoc;
29
30 import org.ofbiz.base.util.Debug;
31 import org.ofbiz.base.util.UtilJ2eeCompat;
32
33 /**
34  * I18nMessageArgumentTag - JSP tag that used inside a MessageTag to create an
35  * ordered list of arguments to use with java.text.MessageFormat.
36  *
37  * @author <a HREF="mailto:k3ysss@yahoo.com">Jian He</a>
38  * @version 1.0
39  * @created April 16, 2002
40  */

41 public class I18nMessageArgumentTag extends TagSupport JavaDoc {
42     
43     public static final String JavaDoc module = I18nMessageArgumentTag.class.getName();
44     
45     public void setValue(Object JavaDoc argumentValue) throws JspException JavaDoc {
46         try {
47             I18nMessageTag messageTag = (I18nMessageTag) this.getParent();
48
49             messageTag.addArgument(argumentValue);
50         } catch (Exception JavaDoc e) {
51             if (UtilJ2eeCompat.useNestedJspException(pageContext.getServletContext())) {
52                 throw new JspException JavaDoc(e.getMessage(), e);
53             } else {
54                 Debug.logError(e, "Server does not support nested exceptions, here is the exception", module);
55                 throw new JspException JavaDoc(e.toString());
56             }
57         }
58     }
59 }
60
Popular Tags