You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Oleg V Alexeev <go...@penza.net> on 2001/11/30 11:56:54 UTC

Re[2]: General model question ?

Hello Ted,

I take a part in developing of application with O/R using. We use
Castor as O/R library.

I think nested tag model can be useful for it. But if we needs to perform
conversion from String values to business object properties then needs
to perform some kind of validation at phase of conversion. Ie -
BeanUtils must throw some kind of exception at any wrong value.
ActionForm setter method can catch such exception and summarize all
this stuff to the Errors object.
Without it we, in our multilangual application, needs to collect
String values in ActionForm, validate and convert it with current
locale (date and numeric values) to the business objects. And in
Action class we can map such objects via Castor to the database.


Friday, November 30, 2001, 6:40:43 AM, you wrote:

TH> Arron Bates wrote:
>> If you want to go this way, I've heard that there's a nesting extension
>> to make this easier too.

TH> So, the underlying purpose of the nested tags is to render the full
TH> "path" to an element when it is situate on a nested bean. Given a
TH> structure like 

TH> +Grandparent
TH> ++Parent
TH> +++Child
TH> ----property

TH> With properties like 

TH> grandparent.getName()
TH> grandparent.getParents()

TH> parent.getName()
TH> parent.getChilds()

TH> child.getName()
TH> child.getAllowance()

TH> We can write something like

TH> <nested:nest property="grandparent">
TH>   <nested:write property="name">
TH>   <nested:iterate property="parents">
TH>     <nested:write property="name">
TH>     <nested:iterate propery="childs">
TH>       <nested:write property="name">
TH>       $<nested:text property="allowance">
TH>     </nested:iterate>
TH>   </nested:interate>
TH> </nested:nest>

TH> With visible output like 

TH> Lou
TH>  Stu
TH>   Tommy
TH>    $1
TH>   Dill
TH>    $0
TH>  Drew
TH>   Angelica
TH>    $10

TH> And have Tommy's allowance element be represented in the HTML as 

TH> $<input type="text" name="grandparent[1].parent[1].child[1].allowance"
value="1">>

TH> When submitted back to the ActinForm, the BeanUtils will then walk this
TH> path so that the allowance property for the first child element of the
TH> first parent element of the first grandparent element (Tommy) is
TH> updated. 

TH> And, it also allows for an abbreviated syntax, since the nested versions
TH> of iterate look to the "enclosing" bean for its "name" property, as the
TH> html form tags look to the ActionForm bean.

TH> Given the support for indexed and nested properties, I can see that we
TH> need a taglib like this to "close the loop". I take it that the
TH> nested-taglib-src is ready to commit as is (it looks that way to me).

TH> Meanwhile, are you updating a JDBC database from a bean like this? 

TH> I agree that this is a valid representation of a model, but most
TH> developers need to persist something like this to a conventional
TH> database.

TH> We typically add a Developers Guide to a taglib, where we could put
TH> notes about your serialization example, alogn with any notes on mapping
TH> this back to a database. 

TH> Is anyone using an O/R tool that would work well with nested beans like
TH> this?


TH> -- Ted Husted, Husted dot Com, Fairport NY USA.
TH> -- Custom Software ~ Technical Services.
TH> -- Tel +1 716 737-3463
TH> -- http://www.husted.com/struts/

-- 
Best regards,
 Oleg                            mailto:gonza@penza.net



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>