JSPMaker Template File
Every template file is stored in the form of a zip file. It contains
the archive of all the necessary files needed to generate the JSP application.
Control file
The core of the template file is a control file named
"control.xml". It is a well-formed XML file and it contains
all the necessary information for the generation process. It is
structured in 3 levels, namely the product level, control level and
session level.
The top level is the product level and is identified by the
<jspmaker> tag. It gives a brief description of the template and
currently serves for documentation purpose only.
The next level is the control level (identified by the <control>
tag). Each <control> specify a JSP file that will be generated
by JSPMaker. At present there are 3 types of files that will be
generated.
Table-related files (type="table")
The JSP files that will perform "list", "view", "add",
"edit", "delete" and "search" functions
on specific database tables
Field-related files (type="field")
The JSP files that will display database blob fields
Other files (type="other")
The "include" files that may be cfm-included by the table-related
files, and security related files
Copy files (type="copy")
Includes files that will be copied directly from
the templates, such as image files
The third level is the session level (identified by the
<session> tag). For each <control>, there can be multiple
sessions that will constitute the output. Each session can be a
specific segment from the input files or a JSPL include statement.
Please refer to the following table for detailed description of the
attributes:
<jspmaker> attributes
date |
Template created date (yyyy/mm/dd) |
version |
Shipped with JSPMaker version |
desc |
Brief description of the template |
author |
Author of the template |
<control> attributes
ofile |
Output file name |
oext |
Output file extension ("cfm") |
type |
Control type:
"table" - table-related files
"other" - JSP include files or security related files
"copy" - files that will be directly copied |
id |
Control id. The following ids are supported at present:
type="table"
id="list" - list page
id="add" - add page
id="edit" - edit page
id="delete" - delete page
id="view" - view page
id="search" - search page
type="field"
id="blobview" - display blob field
type="other"
id="loginh" - login page (hard coded user id and password)
id="loginl" - login page (use information from table for user id and password)
id="logout" - logout page
other ids are treated as JSP include files
type="copy"
all ids are treated as files to be copied |
ifiles |
List of input files to be processed (comma delimited) |
ofolder |
Output file folder (used for type="copy" only) |
cond |
condition for generation |
<session> attributes
type |
Session type:
"key" - output the segment identified by the key from the list of input files
"include" - create an JSPL include statement |
value |
Session value:
type="other"
key value of segment (identified by <!--session id=key--> in input files)
type="include"
include file name |
ifile |
input file that contains the session (if not specified, use ifiles from control) |
cond |
condition for generation |
JSPMaker tags in the template files
JSPMaker replaces the following tags inside the templates to generate the working codes, advanced users can make use of these tags to create custom templates. These tags are case-insensitive.
1. Control Generation
1.1 Session Tags
JSPMaker builds the source of the JSP scripts based on the sequence of
sessions specified in the control file of the template. Each session tag
carries a session name that identifies the script block that JSPMaker
will extract.
Syntax:
<!--@##session ##session_name##--> session content here <!--@##/session##--> 1.2 Optional Tags
The optional tag specifies a condition to control whether a script block
will be generated.
Syntax: <!--@##optional ##condition##--> optional content here <!--@##/optional##-->
For syntax of the condition, please refer to section 4.
1.3 Generate Script Tags (add/edit scripts only)
The Generate Script tag will generate the database update script for
all fields in the table. It is used in "add" and "edit"
scripts only.
Syntax: <!--##gen ##script#condition#parm##--><!--##/gen##-->
For syntax of the condition, please refer to section 4.
The "parm" is optional. If specified, it is used as the suffix
to form the name of the final processing script (i.e. script_parm).
Assumption: recordset name is "rs" and recordset is opened before
calling
1.4 Generate Tables Tags
The Generate Tables tag will generate the enclosed script block repeatedly
for all tables that requires generation.
Syntax: <!--##gen ##tables#condition##--> table script block here <!--##/gen##-->
For syntax of the condition, please refer to section 4.
1.5 Generate Fields Tags
The Generate Fields tag will generate the enclosed script block repeatedly
for all fields that requires generation in the current table.
Syntax: <!--##gen ##fields#condition##--> field script block here <!--@##/gen##-->
For syntax of the condition, please refer to section 4.
1.6 Generate Cond Tags
The Generate Cond tag will generate the enclosed script block if the
condition specified are met.
Syntax: <!--##gen ##cond#condition##--> script block here <!--@##/gen##--> For syntax of the condition, please refer to section 4.
1.7 Generate JS Tags
The Generate JS tag will generate the required JS for the enclosed form
tag.
Syntax: <!--##js##--> <form ...> <!--##/js##-->
2. Language Phrase Replacement Tags
In JSPMaker, all language specific phrases are put in a XML-format
language file. To specify a language phrase replacement in the template,
the language phrase replacement tag is used. During script generation,
JSPMaker will replace the tag with the corresponding phrase found in the
language file.
Syntax: <--##@phrase_id##-->
3. Replacement Tags Replacement tags specify the attributes in the template files that are
replaced with Project, Database, Table or Field specific properties.
(list of replacement tags)
Syntax:
<--##tag_id##-->
4. Condition Checking Condition checking is used extensively in JSPMaker templates to control
the script generation process. Scripts enclosed by the tag will be generated
if condition specified is met.
The syntax of condtion checking is as follow:
condition1[,condition2...]
condition format: Object_Type/Object_Property/Operator/Value1[|Value2...]
Object Type:
proj = current Project object
db = current Database object
table = current Table object
field = current Field object
Object Property: (list of object
properties)
Operator:
EQ = equal
NE = not equal
GT = greater than
GE = greater than or equal to
LT = less than
LE = less than or equal to
IN = contain value
NI = not contain value
Value:
value for comparison
If value start with "%", then rest of value will be treated
as object property
|