Introduction
Molly Pages combine HTML and Java on the server side. Molly is designed
to be simple and transparently easy to use. The generated code is human
readable and easy to debug.
If you like molly pages, then JSP becomes entirely un-necessary. That's
a good thing because JSP sucks ass. (JSP tags are hard to type, visually noisy,
hard to distinguish from HTML, and there is no HTML escape mechanism
from within Java code, a.k.a "heredoc"). Molly was invented to overcome these
shortcomings.
Molly pages are good for database driven web pages. Pure data
requests from the client (AJAX, etc.) should be served using
servlet/comet directly (not via molly pages)
Translation
A page is translated ("compiled") into a java class that implements
the Page interface. A PageServlet then invokes the render method of
the generated class when the page is requested by the browser.
This diagram shows this process graphically.
See the specification page for more details.
A simple example
Here is a simple example of a molly web page. You can browse more examples of
various page tags using the navigation bar above.
(view molly source)
[[
String name = req.getParameter("myname");
if (name != null && ! name.equals("")) {
# Welcome [=name] (<a href="[=getPagePath(req)]">Forget me</a>) #
}
]]
<form name="simple_example" action="[=getPagePath(req)]">
Hello, my name is:
<input type="text" name="myname">
<input type="submit" value="submit">
</form>