Import

An import section defines a java import block. The contents of the import section are placed as-is at the top of the generated page.

A current limitation of the molly parser is these imports cannot be included via a include directive. They have to be declared in the page itself (send me a patch if you have a fix).

Syntax

Import sections can appear anywhere (and as many times as desired) in text sections.
[import
import package.a.b.*;
import package.c;
...etc...
]
Each import statement contained in this section must be a valid java statement. Just like in a regular java class, each import line should be of the form:
import package_declaration;

Tag-Escape

To prevent the tag from being recognized, this tag can be escaped by prefixing the start tag with a backslash: \[import

Example

A molly page containing a import. Note each line within the import block also starts with an import keyword. This was done on purpose, such that import declarations can be cut and pasted into a molly page (this is another one of the many ways in which Molly is better than JSP, with JSP one has to hack existing import declarations off by hand).

[import
import java.util.*;
import java.text.*;
]
[[
List list = new ArrayList();
list.add("hello");
]]
[=list.size()] item.





1 item.