01: /* Page.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: Tue Sep 6 09:35:48 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: * The page action used to set the page info, such as the content type.
28: *
29: * @author tomyeh
30: */
31: public class Page extends AbstractAction {
32: private String _ctype;
33:
34: /** Returns the content type. */
35: public String getContentType() {
36: return _ctype;
37: }
38:
39: /** Sets the content type. */
40: public void setContentType(String ctype) {
41: _ctype = ctype;
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 (_ctype != null)
54: ac.setContentType(_ctype);
55: }
56:
57: //-- Object --//
58: public String toString() {
59: return "page";
60: }
61: }
|