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