I have developed some new tags for dbforms as part of a project.
I am submitting a description here for feedback before adding them to the
code base.
Usage:
isError - execute the body if there is an error ( if value='false', then
execute body is NO error )
redirectURL - generates a redirect to a DbForms View. Setting the
positionattribute will
force DbForms to navigate to this position within the
destination-table
Example:
<db:isError value="false">
<db:isWebEvent event="insert" value="true" >
<db:redirectURL href="/instructor_one.jsp" tableName="instructor">
<db:position fieldName ="instructor_id"
value="${InstructorName.instructor_id}"/>
</db:redirectURL>"
</db:isWebEvent>
</db:isError>
=============
CustomFormatter, allows you register a class that will used to format a
field for output. Usuful for displaying id numbers and such
That are stored as numbers but need to be displayed specially.
Class ICustomFormatter
public interface ICustomFormatter {
public String format(String s, Field f, Tag tag);
public void init(Object arg);
public void setReset(boolean b);
public boolean getReset();
}
Usage:
setCustomFormatter - register a customFormatter class for later use
new attribute x added to DbBaseHandlerTag (parent of label,etc..)
Example
<db:setCustomFormatter name="ostid"
className="com.nechsi.santipol.interceptors.IDCustomFormatter"
arg="###-####" />
<db:label customFormatter="ostid" fieldName="old_student_code"/>
====
<tag>
<name>redirectURL</name>
<tag-class>org.dbforms.taglib.DbRedirectURLTag</tag-class>
<body-content>JSP</body-content>
<description>generates a link to a DbForms View</description>
<attribute>
<name>href</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<description>the url of the JSP file representing the view</description>
</attribute>
<attribute>
<name>tableName</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<description>
the url of the table the
view represents
</description>
</attribute>
<attribute>
<name>position</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description>
optional: the position to navigate to within table "tableName"
for backwards compatibility is the same as
destPos!</description>
</attribute>
<attribute>
<name>parentField</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description>
used if parentTable is different to tableName:
field(s) in the main form that is/are linked to this form
</description>
</attribute>
<attribute>
<name>childField</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description>
used if parentTable is different to tableName:
field(s) in this form that is/are linked to the parent form
</description>
</attribute>
<attribute>
<name>destPos</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description>
a value indicating the row to navigate to.
Position strings are used as request parameters
allowing the framework to keep track
of the position the user comes from or goes to. This
string is
structured as follows:
fieldId : fieldValueLength : fieldValueIt is important to note
that if multiple keys exist in the definition
of the table, your position string must includes values
for each
key. (separated by dashes (-))
Example:<! Jump to another JSP, specify position
using multiple keys-->
<db:gotoButton caption="View Sample Details"
destination="/viewSample.jsp"
destTable="Sample"
destPos="1:6:widget-3:2:23"/>
</description>
</attribute>
<attribute>
<name>keyToDestPos</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description>
a key indicating the row to navigate to.
Example:
<! Jump to another
JSP, specify position through a key -->
<db:gotoButton
caption="View Sample
Details"
destination="/viewSample.jsp"
destTable="Sample"
keyToDestPos="[EMAIL PROTECTED]"/>
</description>
</attribute>
<attribute>
<name>keyToKeyToDestPos</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description>
a key to the key indicating the row to navigate to.
For each record in the result-set,
the associatedRadio tag generates a key reference
which can be used to retrieve a position string.
Example:<!for each record, generate a key to the
position string -->
<db:body><db:associatedRadio
name="test"/></db:body>
<db:footer>
<! Jump to another
JSP, specify position
(get second record using
appropriate key!)-->
<db:gotoButton
caption="View Sample
Details"
destination="/viewSample.jsp"
destTable="Sample"
keyToKeyDestPos="test"/>
Check "customerlist.jsp" in example!
</description>
</attribute>
<attribute>
<name>singleRow</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description>
if set to true, only one row
of data will be fetched.
default is false, so that
all rows of data will be fetched and
the requested record will be
set as actual record.
</description>
</attribute>
<example>generates a redirect to a DbForms View. Setting the
positionattribute will
force DbForms to navigate to this position within the
destination-table
the 3 examles below produce all the same result<redirectURL
href="customer.jsp" tableName="customer"
position="103~2"/><redirectURL href="customer.jsp"
tableName="customer" position="<%= currentKey %>"/><redirectURL
href="customer.jsp" tableName="customer">
<position field="id" value="103"/>
<position field="cust_lang" value="2"/>
</redirectURL>
</example>
</tag>
<tag>
<name>isError</name>
<tag-class>org.dbforms.taglib.IsErrorTag</tag-class>
<body-content>jsp</body-content>
<description>
Allows a developer to detect if an error has been reported.
</description>
<attribute>
<name>name</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description>the name that should be used for retrieving the error-data from
the session. Default = "errors"</description>
</attribute>
<attribute>
<name>value</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description>Condition in which to evaluate body. Default is set to
true.</description>
</attribute>
</tag>
<tag>
<name>setCustomFormatter</name>
<tag-class>org.dbforms.taglib.SetCustomFormatterTag</tag-class>
<body-content>JSP</body-content>
<description>Register a Custom Formatter for later use</description>
<attribute>
<name>name</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<description>name to use, other tags will use this as the value for the
customFormatter attribute</description>
</attribute>
<attribute>
<name>className</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<description>FQ ClassName to load</description>
</attribute>
<attribute>
<name>arg</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description> optional: arg passed to instance</description>
</attribute>
<attribute>
<name>reset</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description>set false to prevent multiple re-initializations.default
false</description>
</attribute>
<example>
<db:setCustomFormatter name="stid"
className="com.nechsi.santipol.interceptors.IDCustomFormatter"
arg="####-####-####-####" />
<db:setCustomFormatter name="ostid"
className="com.nechsi.santipol.interceptors.IDCustomFormatter"
arg="###-####" />
</example>
</tag>
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
DbForms Mailing List
http://www.wap-force.net/dbforms