01: package com.opensymphony.webwork.components;
02:
03: import com.opensymphony.xwork.util.OgnlValueStack;
04: import org.apache.commons.logging.Log;
05: import org.apache.commons.logging.LogFactory;
06:
07: import javax.servlet.http.HttpServletRequest;
08: import javax.servlet.http.HttpServletResponse;
09: import java.io.Writer;
10:
11: /**
12: * ClosingUIBean is the standard superclass for UI components such as div etc.
13: *
14: * @author Patrick Lightbody
15: * @author Rene Gielen
16: * @version $Revision: 2468 $
17: * @since 2.2
18: */
19: public abstract class ClosingUIBean extends UIBean {
20: private static final Log LOG = LogFactory
21: .getLog(ClosingUIBean.class);
22:
23: protected ClosingUIBean(OgnlValueStack stack,
24: HttpServletRequest request, HttpServletResponse response) {
25: super (stack, request, response);
26: }
27:
28: String openTemplate;
29:
30: public abstract String getDefaultOpenTemplate();
31:
32: /**
33: * Set template to use for opening the rendered html.
34: * @ww.tagattribute required="false"
35: */
36: public void setOpenTemplate(String openTemplate) {
37: this .openTemplate = openTemplate;
38: }
39:
40: public boolean start(Writer writer) {
41: boolean result = super .start(writer);
42: try {
43: evaluateParams();
44:
45: mergeTemplate(writer, buildTemplateName(openTemplate,
46: getDefaultOpenTemplate()));
47: } catch (Exception e) {
48: LOG.error("Could not open template", e);
49: e.printStackTrace();
50: }
51:
52: return result;
53: }
54: }
|