1 package org.apache.turbine.modules.layouts;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.turbine.TurbineConstants;
23 import org.apache.turbine.modules.Layout;
24 import org.apache.turbine.services.jsp.TurbineJsp;
25 import org.apache.turbine.services.jsp.util.JspNavigation;
26 import org.apache.turbine.services.jsp.util.JspScreenPlaceholder;
27 import org.apache.turbine.util.RunData;
28
29 /***
30 * This Layout module allows JSP templates to be used as layouts. Since
31 * dynamic content is supposed to be primarily located in screens and
32 * navigations there should be relatively few reasons to subclass this Layout.
33 *
34 * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
35 * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
36 * @version $Id: JspLayout.java 534527 2007-05-02 16:10:59Z tv $
37 */
38 public class JspLayout
39 extends Layout
40 {
41 /*** The prefix for lookup up layout pages */
42 private String prefix = TurbineConstants.LAYOUT_PREFIX + "/";
43
44 /***
45 * Method called by LayoutLoader.
46 *
47 * @param data RunData
48 * @throws Exception generic exception
49 */
50 public void doBuild(RunData data)
51 throws Exception
52 {
53 data.getResponse().setContentType("text/html");
54 data.declareDirectResponse();
55
56
57 data.getRequest()
58 .setAttribute(TurbineConstants.SCREEN_PLACEHOLDER,
59 new JspScreenPlaceholder(data));
60
61
62 data.getRequest().setAttribute(
63 TurbineConstants.NAVIGATION_PLACEHOLDER,
64 new JspNavigation(data));
65
66
67 String templateName = data.getTemplateInfo().getLayoutTemplate();
68
69 TurbineJsp.handleRequest(data, prefix + templateName, true);
70 }
71 }