01: /* Include.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: Tue Sep 20 10:09:14 2005, Created by tomyeh
10: }}IS_NOTE
11:
12: Copyright (C) 2005 Potix Corporation. All Rights Reserved.
13:
14: {{IS_RIGHT
15: This program is distributed under GPL Version 2.0 in the hope that
16: it will be useful, but WITHOUT ANY WARRANTY.
17: }}IS_RIGHT
18: */
19: package org.zkoss.web.servlet.dsp.action;
20:
21: import java.io.IOException;
22:
23: import org.zkoss.web.mesg.MWeb;
24: import org.zkoss.web.servlet.ServletException;
25:
26: /**
27: * Includes another URL.
28: *
29: * @author tomyeh
30: */
31: public class Include extends AbstractAction {
32: private String _page;
33:
34: /** Returns the page (URI). */
35: public String getPage() {
36: return _page;
37: }
38:
39: /** Sets the page (URI). */
40: public void setPage(String page) {
41: _page = page;
42: }
43:
44: //-- Action --//
45: public void render(ActionContext ac, boolean nested)
46: throws javax.servlet.ServletException, IOException {
47: if (!isEffective())
48: return;
49: if (nested)
50: throw new ServletException(
51: MWeb.DSP_NESTED_ACTION_NOT_ALLOWED, new Object[] {
52: this , new Integer(ac.getLineNumber()) });
53: if (_page == null)
54: throw new ServletException(MWeb.DSP_ATTRIBUTE_REQUIRED,
55: new Object[] { this , "page",
56: new Integer(ac.getLineNumber()) });
57: ac.include(_page, null);
58: }
59:
60: //-- Object --//
61: public String toString() {
62: return "include";
63: }
64: }
|