01: /*
02: * Copyright 2002-2005 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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:
17: package org.springframework.web.servlet.view.tiles;
18:
19: import javax.servlet.http.HttpServletRequest;
20:
21: import org.springframework.context.MessageSource;
22: import org.springframework.web.servlet.support.JstlUtils;
23:
24: /**
25: * Specialization of TilesView for JSTL pages; Tiles pages that
26: * use the JSP Standard Tag Library.
27: *
28: * <p>Exposes JSTL-specific request attributes specifying locale
29: * and resource bundle for JSTL's formatting and message tags,
30: * using Spring's locale and message source.
31: *
32: * <p>This is a separate class mainly to avoid JSTL dependencies
33: * in TilesView itself.
34: *
35: * @author Juergen Hoeller
36: * @since 20.08.2003
37: * @see org.springframework.web.servlet.support.JstlUtils#exposeLocalizationContext
38: */
39: public class TilesJstlView extends TilesView {
40:
41: private MessageSource jstlAwareMessageSource;
42:
43: protected void initApplicationContext() {
44: super .initApplicationContext();
45: this .jstlAwareMessageSource = JstlUtils
46: .getJstlAwareMessageSource(getServletContext(),
47: getApplicationContext());
48: }
49:
50: protected void exposeHelpers(HttpServletRequest request)
51: throws Exception {
52: JstlUtils.exposeLocalizationContext(request,
53: this.jstlAwareMessageSource);
54: }
55:
56: }
|