JSP Engine Tech

The java sources japano generates out of JSP Document have another structure than usual. Japano uses the JSP document elements to create a tree of page node instances and Strings. The full tree is created when the page instance is created. It is initialized with constant attributes (included constant expressions) once. When the page is generated the page is first initialized with the current scopes and the current buffer. The tree nodes is visited recursively to dump their children to the current buffer. After all page nodes have dumped their children successfully, the content of the buffer is sent back to the client.

The buffer just doesn't have a normal buffer but collects the string instances the page nodes give him or creates new string objects where the page node output is not a string with new string creation being the exception. ( If you want to grok this in detail take a look at the source of org.japano.PageNode and the generated JSP java sources under WEB-INF/scratch )

EL expression compiler
Japano converts the EL expressions into equivalent java expressions at JSP compilation time:

org.japano.el.JavaExpressionGenerator offers a main method which takes an el expression as arguments and dumps the parser tree of this el expression and the generated code.


JSP compatibility

One of the reason japano was started was a dissatisfaction with JSP and the way custom tags are implemented in it. In this regard japano does not even aspire to be 100% JSP compatible. Apart from that I tried to follow the JSP path but japano is still a very young project. So the current feature set of the JSP engine is mainly determined by how much I like a certain feature and how easy it is to implement.

I like to keep the JSP document only declarative with no code embedded in them but only html tags, custom tags and el expressions and static includes or tag files. These elements are sufficient for the vast majority of pages. In cases where that is not sufficient I usually found it better to write the page functionality completely in java code. japano allows you to write your own view generators which can be very helpfull for that. If the content you are using is string based you can use japano's org.japano.Buffer class as a helper to create the content. (See org.japano.util.JSON for an example of this). If your content is binary you can use the HttpSerlvetResponse you receive as argument of your action to answer the request yourself. The separation achieved by using only declarative elements in the documents gives your project an stable interface of tag and element names. While this separation is even usefull when only one persion is developing the website,its main benefits are to be able to let differently abled people collaborate on a website. The developers define the declarative interface and are free to rearrange code or functionality. web designers are able to design the website around a clean tag oriented functionality without syntactic noise.

These features are supported in the current state:

Not supported are: