|
On the
Struts platform, the form-beans are the transfer objects. Struts uses Jakarta
Beans Utilities to auto-populate the form beans, and extract data from them;
this why the names and properties are reflected in the implementation tags.
As such,
the conversion type specification for an element, is actually the attribute
type within the form bean.
The conversion types
are meant to ensure that the purely string web entries could be converted to
the attributes of the models, which the form beans stand as proxies.
As could be seen in
the overview section, dWebSpec conversion types are similar to Java types, or
in general similar to languages that evolved form C/C++.
For implementation on
the Struts platform, the specification would be reflected in the implementation
of the form bean.
It is more typical,
that the form-beans (transfer objects) are designed as objects that mirror the model
objects. As such these objects would be implemented on the server side.
There are cases like
login pages, that that their implementations could start from the descriptor
specifications. Struts provides a means of preparing XML entries from the name
and conversion types of the elements. These are called DynaForms.
The entry in the Struts configuration for standard form bean
object is as follows.
<form-bean name="categoryForm" type="com.example.CategoryForm"/>
The reflect the fact fact that this object would be part of
the a library, and that a reference to it is being registered.
For DynaForms, the field definitions would be included in
Struts configuration as shown below:
<form-bean name="categoryForm"
type="org.apache.struts.validator.DynaValidatorActionForm">
<form-property name="categoryId" type="java.lang.String"/>
<form-property name="name" type="java.lang.String"/>
<form-property name="description" type="java.lang.String"/>
</form-bean>
This would represent
the form bean implementation.
CONVERSION TYPE
Standard
Types |
|
Java Types |
string
(default) |
|
String |
byte |
|
byte |
short |
|
short |
integer |
|
int |
long |
|
long |
float |
|
float |
double |
|
double |
date |
|
Date |
boolean |
|
boolean |
In specifying types, Struts included some additional
types for credit card, email and URL validations.
|