KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > uitags > tagutil > i18n > JstlMessageFinder


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

18 package net.sf.uitags.tagutil.i18n;
19
20 import javax.servlet.jsp.PageContext JavaDoc;
21 import javax.servlet.jsp.jstl.fmt.LocaleSupport;
22
23
24 /**
25  * JSTL message finder adapter.
26  *
27  * @author jonni
28  * @version $Id$
29  */

30 public final class JstlMessageFinder implements MessageFinder {
31   private static final long serialVersionUID = 100L;
32
33   /**
34    * Required by LocaleSupport
35    */

36   private PageContext JavaDoc pageContext;
37
38   /**
39    * Default constructor.
40    */

41   public JstlMessageFinder() {
42     super();
43   }
44
45   /** {@inheritDoc} */
46   public void setPageContext(PageContext JavaDoc pageContext) {
47     this.pageContext = pageContext;
48   }
49
50   /** {@inheritDoc} */
51   public String JavaDoc get(String JavaDoc key) {
52     return LocaleSupport.getLocalizedMessage(this.pageContext, key);
53   }
54
55   /** {@inheritDoc} */
56   public String JavaDoc get(String JavaDoc key, Object JavaDoc arg0) {
57     return LocaleSupport.getLocalizedMessage(
58         this.pageContext, key, new Object JavaDoc[] { arg0 });
59   }
60
61   /** {@inheritDoc} */
62   public String JavaDoc get(String JavaDoc key, Object JavaDoc[] args) {
63     return LocaleSupport.getLocalizedMessage(this.pageContext, key, args);
64   }
65 }
66
Popular Tags