struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benjamin Hood" <h...@adesso.de>
Subject [PATCH] RequestProcessor : Populating non-String Bean fields
Date Sun, 13 Jul 2003 16:29:01 GMT
Hallo,

I'm very new to MVC Frontends but thing I have noticed is that many struts
applications replicate business objects through forms, which are just the
string representation of the business data.

I have noticed that there has been some discussion about automatically
populating non-String Bean fields through the RequestProcessor facility.

Therefore I am submitting a working sugestion, which may or may not seem
sensible. As I said, this is just a first version of a solution to a
problem that I am confronted with in a productive situation, so there are
many details which would need to brushed up, if this approach was to be
followed any further (e.g. XML-Configuration, Default configurations,
creating a separate RequestProcessor, examples, testing, etc).

Briefly:

- I tentatively called this the FromString plugin (because that's what it
does).
- It uses the plugin mechanism.
- For speeds sake, I patched the RequestProcessor and the RequestUtils
(although one could create a separate RP, but I didn't because I gathered
through various discussion threads that the RP interface is going to be
changed - but correct if I'm wrong).
- It has a static configuration at the moment (so any further developement
would need to use the Digester mechanism).
- Because of this static config, the package contains a TestForm, in order
to prevent a cyclical dependency during deployment (for testing).
- It just provides the String2java.util.Date conversion at the moment.
- It has been tested with a simple JSP that sets a bean field of the type
java.util.Date
- The plugin essentially defines a collection of conversion services, which
can be configured at the field level of any given bean.
- For example, Bean XXX has fields 1 to n, where field i is a Date field.
Therefore the field[i] of XXXBean is mapped to Conversion object which is
invoked when the Bean gets populated after the View form has been
submitted.
- Of course, Conversion objects can be reused and one can map any number of
fields in any bean.
- (Maybe I've forgotten something, but I don't think so)

As I mentioned above, I would like to use such a mechanism in production
code, but if anybody feels that this kind of thing might be useful for the
general framework, I would quite happy to brush it up and submit it as open
source code, rather than just implementing proprietry code (of course
taking any further suggestions into account).

Cheers,

Ben


Mime
View raw message