Hybrid Server Pages beyond JSP
Hybrid Server Pages beyond the Java Server Pages
JSP combined HTML and Java in one source text but did not go far enough. Hybrid Java Language (HJL) is the next step in the same direction. HJL supports code reuse in the form of widgets written in same Hybrid Java Pages. Generated Java code gets built into a natural pages and components framework wrapped around Servlet API.
Hybrid Java Language incorporates Java and HTML operators into a single formal grammar.We may consider the language as consisting of three parts – subset of Java, subset of HTML and all the rest. The latter serves for code factorization and reuse as well as for ‘gluing’ Java and HTML. Widgets are the units of code reuse.
The Hybrid Java Pages code of an application is provided as a set of .page files (one per Web page) and a set of .widget files. A widget may define named attributes and/or named slots (or one anonymous slot). A slot is somewhat similar to the position between opening and closing a ‘library tag’. The code inHybrid Java Pages slots has Java context of the point of call of the widget, so widgets are transparent for Java context (same as HTML elements are by the way).
The rest of the .widget file is just ARBITRARY Hybrid Java Pages code – no other programming support or configuration is necessary to define a widget.
Technology suggests a very natural framework that includes application, page and widget data persistent in the scope of HTTP session. Developer defines such data as members of ‘code-behind’ classes, which may contain handlers of those states called by the framework with a proper dispatching in case of widgets.
Compiler resolves the identifiers used in widgets and pages against Java definitions in Java blocks, definitions of widget attributes, in instances of widgets and page state classes. Widgets may send signals to parent and page.
0 comments:
Post a Comment