MollyPages.org
"You were wrong case. To live here is to live." |
Pages /
Database /
Forms /
Servlet /
Javadocs
/
License & Download /
Tutorials /
Cookbook
/
Contact & Hire
|
Here's the grammar for Molly server pages.
The parser class is fc.web.page.PageParser. It is a hand-coded recursive-descent parser. The code can be modified easily to change the page syntax. Don't like using [[ brackets for code sections ? Change them to whatever you want !
You can also add new top-level tags of your own liking.
Pages cannot be subclassed further. You can, however, import and use any package within the page.
Note: as with servlets, there can be multiple threads running the Initialization Pages cannot be defined with a constructor that takes arguments (for class loading reasons). The init method is invoked (once) when the page is loaded (and before it is run). This method acts as a pseudo contructor and should be used to initialize page instance/static variables as necessary.
Compilation errors have line numbers corresponding to the compiled java source. This java source can also be found at WEB-INF/molly_tmp and is very useful for debugging.
Note, however that any fixes to your code should be made to the page (*.mp) and not to the java source (*.java), since the java source will be rewritten whenever the page is modified.
Pages have access to implicit local variables. These implicit local variables are available in the render method of the page (hence can be used in text, code and hash sections):
- out
- The PrinterWriter to which one out.println(..), from within java code sections.
By default, this is a PrintWriter but this can be changed to an OutputStream by using a page directive.
- req
request- The HttpServletRequest object or this request
Note: you can use the short word
req
or the larger wordrequest
to refer to the same object.- res
response- The HttpServletResponse object for this request.
Note: you can use the short word
res
or the larger wordresponse
to refer to the same object.
Since pages extend PageImpl, they also have access to inherited methods/variables from this superclass. Some of these superclass methods include those for: