|
Hi,
I am relatively new to xDoclet and my problems
may come from incorrect use, if it is so pls let me know.
While using the Struts form template I have
encountered few problems that may be relevant to others as well, if it is
the case maybe template should be updated:
1. Struts form properties should be of type String
rather than of the business type (Date, Integer etc) as they are right now. The
fields will be set automatically based on the HTTP request parameters. As HTTP
request parameters are Strings xDoclet generated ActionForm with Date
field will fail in rather cryptic way.
2. If you have the Data object with different
field types then Action form then bulk data access methods (setData
/getData) will not work that easilly. The simplest solution is to provide merge
points for body of both methods.
I use the runtime typeconverter (mapper) by Andrej
Sobkowski (http://www.mycgiserver.com/~andrej/technical/struts/struts.jsp).
It could be used in sample implementations of the merged setDate/getData
methods.
3. It is usefull to also have setData method
generated in addition to getData. Using StrutsForm.setData(myVO) rather then
constructor new StrutsForm(myVO) seems better since Struts will ofter
provide form object that is already placed in the relevant scope (request, page
etc.) under relevant key. All the action has to do is to update contents of this
object. Action class does not have to know the scope or the key of the object
and does not have to manually insert it. Also there is less objects discarded.
Attached is form template I am using currently -
seems to work, but may still have bugs. It requires the earlier mentioned
mapper. It does not have the constructor, it is useful in some situations,
so it can be copied from original template.
Regards,
Michael
|
struts_form.j
Description: Binary data
