Directive
Specifies directives and misc. options to the page parser.
Current directives are:
- mimetype=value
- The mime type for the page (sent to client as part of the response
header).
The value of "none" or an empty string will turn off
writing any mimetype entirely (the user can then manually write
a mimetype via the javax.servlet.ServletResponse.setContentType
method manually).
If not specified, the default mimetype is: Page.DEFAULT_MIME_TYPE ("text/html")
- encoding=value
- This is the charset encoding sent to the client in the HTTP response
header.
If not specified, the default mimetype is: Page.DEFAULT_ENCODING ("ISO-8859-1")
- src-encoding=value
- This is the charset encoding of the molly source page.
See Charset discussion on when to use this.
- buffersize=value
- The buffer size for the page. The page is sent to the client
once the buffer size is reached.
If not specified, the default size is: Page.DEFAULT_BUFFER_SIZE ("8048")
- out=value
- Specifies whether to use a ServletResponse outputstream or a
ServletResponse PrintWriter. Valid values are outputstream,
stream (either of which choose the outputstream) or
writer (for the printwriter).
- remove-initial-emptylines=true|1
- Removes any initial empty lines from the output. Empty lines can happen because of molly tags
that are separated by empty lines (the empty lines are sent to the client since they becomes part of
the textual section)
- remove-all-emptylines=true|1
- Removes all empty lines from the output. Empty lines can happen because of molly tags
that are separated by empty lines (the empty lines are sent to the client since they becomes part of
the textual section). This is useful when sending JSON, etc, when empty lines anywhere in the output
are superfluous.
Syntax
Page directives can appear anywhere in text sections.
[page ..directive.. ]
Quotes are optional for directive values. For example:
[page mimetype=foo/bar]
and [page mimetype="foo/bar"]
are both valid directives.
Tag-Escape
To prevent the tag from being recognized, this tag can be escaped by
prefixing the start tag with a backslash: \[page
Example
A page with a plain text mime-type (which prevents the browser from
interpreting it as HTML).
<html>
[page mimetype='text/plain']
<body>
<table><tr><td>test</td></tr></table>
</body>
</html>
<body>
<table><tr><td>test</td></tr></table>
</body>