|
From: Alef A. \(JTeam\) <al...@jt...> - 2003-07-23 15:13:39
|
Hi everybody,
I've ran into some issues concerning some of the MVC stuff. Below I'll
discuss those issues. I'd like your opinions about it and see if we can
integrate some (or all) of changes (which are actually quite small).
1) ***** Changes to BindTag to support children tags to reach BindTag's
attributes
One of the cool features of JSP is the possibilities to nest tags and
find attributes of parent tags to perform operation relative to the
parent tag. When considering i21:bind, custom tags in the body of the
i21:bind tag could perfectly use the Errors object and the BindStatus
object to perform extra BindStatus specific functionalities (like
localization based on the BindStatus). Giving child-tags of i21:bind
access to Errors and BindStatus would allow for a lot more generic JSP
code, like the following:
<i21:bind path="command.firstName">
<tr>
<td><jt:localizeField/></td> (instead of <jt:localizeField
key="jteam.site.data.Account.firstName"/>
</tr>
<tr>
<td><input type="blabla" value="blabla"></td>
</tr>
</i21:bind>
Using the newly created EL-based i21:bind version, there's even more
powerful possibilities.
So the change I'm proposing is the following:
A) the adding of a getter for the Errors object in BindTag
B) the adding of a getter for the current property in BindTag (and the
creation of a class-global field to support this)
Modified source is included.
2) ***** Changes to BaseCommandController to allow for the creation of a
ListController
We've created a ListController that simply extends the
AbstractController, but this does not really fulfil to our needs (we
need to have PropertyEditors here as well to render appropriate Strings
for for instance a date or a locale). Therefore we need to be able to
extend BaseCommandController which has all the functionality we need and
then be able to replace the target object in the BeanWrapper(Impl) to
support iteration over the List. To support lists we need an
ListDataBinder (extending ServletRequestDataBinder), which would allow
changing the target object in the BeanWrapper (by using the
setWrappedInstance method).
This addition would free the way for the creation of a ListController
that instead of a single command object, would insert a DataBinder for a
List of object. The c:forEach tag can then be used to iterate over the
list AND rendering the properties of the object in the list, using the
PropertyEditors including the the databinder!
Changes: nonfinal method createBinder() in BaseCommandController
protected ServletRequestDataBinder createBinder(HttpServletRequest
request, Object command)
Additions: ListDataBinder (extending ServletRequestDataBinder)
Additions: AbstractListController (overriding handleRequestInternal to
allow for lists to be returned in a DataBinder
I'm currently keeping track of the changes in a local source-distro of
Spring, I'll post some of the results later on, and I might be able to
set up a simple application that shows the behavior...
Maybe you guys already have some opinions about the implementation of
this?
Cheers,
Alef
|