JSP Module

JSP Module

The JSP module assists in the creation of web GUI elements for your projects. It creates HTML code fragments for all your data elements
plus useful Java code to help keep your jsp files as code free as possible. Sitting on top of the jsp module proper is the JSight auto-admin
writer. This uses the generated elements and code to create an administration system which links all the tables, shows all the findBys,
allowing you to search, jump from table to table, search, edit with validation, delete etc.


An administration system alone can be a 6 month project to do properly. With JSight you get it for free. You can see it in action here:

http://www.javelinsoft.com/northwind

In order to use the jsp module you need to include the following writer:

$GENERATOR.AggregateWriter jsp

The JSP writers create several files.

  • HTML code fragments for data elements, for forms, tables, read-only etc. Dreamweaver ready for drag and drop.
  • Holder classes that automatically parse web forms, transferring fields between beans and HTML. Makes jsps much cleaner.
  • JSP files for the JSight auto-admin system.

As well as targeting tables the JSP module has the concept of a form. As form is a subset of the fields of a table, in a certain order.

Form Properties

This is not JSP specific, but is used by JSPs.

TableName.client.form.formname=

You create forms for a table by tagging .client.form. and the form name onto the tablename then specifying which fields
you'd like in the form, and the order. e.g.

Job.client.form.showJob=jobTitle,minWageOffered,minRateOffered

Field Properties

Field specific properties, e.g. TableName.FieldName

client.decimalFormat=

client.comment
client.labelname
client.password=false

client.readOnly=false
client.default
client.multiline.width
client.multiline.height

client.width=0
client.internalComment

The client.comment allows you to add tooltips and the like to a field.

The client.labelname allows you to change the label for a field.

The client.password allows you to specify that this is a password field, i.e. do not display it openly.

The client.readOnly allows you to specify that the Holder class should not try to set this field, i.e. form editing will not change this field.

The client.default allows you to specify the default value for this field in a new record.

The client.multiline.width and height allows to specify that this field should be displayed multiline, and by what dimensions.

The client.width is for non multiline fields. Specify 0 means make the field large enough to display its maximum length of data, e.g no scrolling.

The client.internalComment allows you to specify any comments to insert in code next to this field. Useful for explaining meaning of field.

The client.decimalFormat lets you decide how numbers are displayed and parsed e.g.

Products.unitPrice.client.decimalFormat=$MONEYFORMAT

With MONEYFORMAT being equal to $MONEYFORMAT=#,##0.00 you get numbers formatted with commas and to 2 decimal places,
as well as being able to be parsed the same way, i.e. we can parse number with or without the commas. Basically it used the Java
DecimalFormat class.

JSP Properties

jsp.rootPathName=$ROOT/web
jsp.fragmentPathName=elements/generated
jsp.libraryPathName=Library
jsp.uiPackage=$UIPACKAGE


jsight.webrootPathName=admin
jsight.webrootElementsPathName=admin/elements
jsight.password=
jsight.tables=
jsight.forms=
jsight.readOnly=false

The rootPathName property refers to the root directory of where jsp files need to be deployed

The fragmentPathName property refers to a subdirectory of rootPathName where you would like to generate sample forms

The libraryPathName property refers to a subdirectory of rootPathName where you would like to generate HTML code fragments

The uiPackage property refers to the package where you would like Holders to go to, by default its called ui

The webrootPathName property is the subdirectory of rootPathName where you'd like the jsight code to go

The webrootElementsPathName property is the subdirectory of rootPathName where you'd like the jsight elements code to go

The password property allows you to specify that someone must have a certain password to use the admin system

The tables property is a list of comma separated tables to display using JSight. If blank it uses all the tables

The forms property is a list of comma separated forms to display using JSight. If blank it uses all the forms

The readOnly property is set to true when you want all tables/forms to be readOnly, i.e. no editing/deleting. Useful when you want public read access, but not write.

JSP Files

The HTML fragments go in the Library subdirectory. They end in .lbi so as to be drag and drop ready for Dreamweaver.

For instance its easy to drag and drop an element from the sample forms in fragmentPathName and into your own form in Dreamweaver.
As well as being the correct HTML for your elements, it will also connect up to your data properly.

Should you regenerate and change some fields, you simply resynchronize within Dreamweaver, e.g. Modify/Library/Update pages...,
so that the fields within your form changes, but the forms themselves do not. This way you can separate the fluffy graphics, formatting,
layout of a form from its data contents. If you add new fields you simply drag the new fields into your forms and because
they connect up to the data that is all you have to do.

The JSight modules uses these fragments on generation when creating the jsp pages for the JSight system, and the Holders when
creating the edit pages.