1 package org.apache.turbine.services.jsp.util;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.commons.logging.Log;
23 import org.apache.commons.logging.LogFactory;
24
25 import org.apache.turbine.modules.ScreenLoader;
26 import org.apache.turbine.services.template.TurbineTemplate;
27 import org.apache.turbine.util.RunData;
28
29 /***
30 * Returns output of a Screen module. An instance of this is placed in the
31 * request by the JspLayout. This allows template authors to
32 * place the screen template within the layout.<br>
33 * Here's how it's used in a JSP template:<br>
34 * <code>
35 * <%useBean id="screen_placeholder" class="JspScreenPlaceholder" scope="request"/%>
36 * ...
37 * <%= screen_placeholder %>
38 *</code>
39 *
40 * @author <a href="john.mcnally@clearink.com">John D. McNally</a>
41 * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
42 * @version $Id: JspScreenPlaceholder.java 534527 2007-05-02 16:10:59Z tv $
43 */
44 public class JspScreenPlaceholder
45 {
46 /*** Logging */
47 private static Log log = LogFactory.getLog(JspNavigation.class);
48
49
50 private RunData data;
51
52 /***
53 * Constructor
54 *
55 * @param data A Rundata Object
56 */
57 public JspScreenPlaceholder(RunData data)
58 {
59 this.data = data;
60 }
61
62 /***
63 * builds the output of the navigation template
64 */
65 public void exec()
66 {
67 String template = null;
68 String module = null;
69 try
70 {
71 template = data.getTemplateInfo().getScreenTemplate();
72 module = TurbineTemplate.getScreenName(template);
73 ScreenLoader.getInstance().exec(data, module);
74 }
75 catch (Exception e)
76 {
77 String message = "Error processing navigation template:" +
78 template + " using module: " + module;
79 log.error(message, e);
80 try
81 {
82 data.getOut().print("Error processing navigation template: "
83 + template + " using module: " + module);
84 }
85 catch (java.io.IOException ioe)
86 {
87 }
88 }
89 }
90 }