Thank you for your interest in the AJT Templates.
The AJT Templates is a JSP tag library to enhance your JavaScript code.
It allows you to use JavaScript templates and C-like preprocessor (#define, #ifdef, #if, etc)
Dynamic Compilation
When JSP is requested, templates are compiled and saved as a JavaScript file on server-side.
The generated JS file is reused for other requests until the template are updated.
|
|
|
Multiple Engines
Multiple template engines can be invoked from AJT Custom tag.
Embedded JavaScript (EJS),
Closure Templates (SOY),
JavaScript Templates (JST),
JSmarty,
jQuery Templates,
Ajax Pages
and AJT Tags (built-in template) are available.
Example 1) Hello Template
Declare AJT tag library and specify templates in <a:script> tag.
hello.jsp
Describe template in {template} tag.
JavaScript in braces {} is executed, and expression between {$ } is evaluated.
hello.ajt
It will be converted into the HTML content below:
Hello My Name!
Hello My Name!
Hello My Name!
Hello My Name!
Hello My Name!
Hello My Name!
Example 2) Assert Macro
Define macros and JavaScript functions in <a:preprocessor> tag or AJT template file.
In this sample, ASSERT, PRINTLN, PRINT, _print are defined only if DEBUG environment variable is 'ture'.
Otherwise, they are replaced with an empty value (removed from your code).
macros.jsp
Call the macros in your templates.
ASSERT, PRINTLN, PRINT are replaced with the replacement defined when the templates are processed.
template.ajt
If the DEBUG env variable is true, the template will be converted into below:
If the DEBUG env variable is NOT true, the template will be converted into below:
(PRINTLN and ASSERT are removed from your code)
Any questions and comments, please send e-mail to us at
webtestfeedback@yahoo.co.jp
Change Records
Jan 20, 2011: 0.3.0 is released
Dec 20, 2010: 0.2.0 is released
Nov 20, 2010: 0.1.0 is released
|