commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hubert Rabago <hrab...@gmail.com>
Subject Re: [digester] help with digester rules
Date Fri, 07 Jan 2005 17:47:12 GMT
Wendy,

Take a look at the setNestedProperties rule.  I believe this sets
properties from nested elements, like your preferredName.

Also, though I haven't used the rules.xml style of specifying rules
(cause I have custom rules that aren't supported), I'm pretty sure
that if your attr name and prop name are the same, you don't need to
list them when you use the setProperties rule.

hth,
Hubert


On Fri, 07 Jan 2005 10:17:06 -0700, Wendy Smoak <Wendy.Smoak@asu.edu> wrote:
> 
> I've only used Digester as a part of Struts, but now I'm trying a simple
> standalone example.
> 
> I have this XML:
> <person key="012456">
>   <preferredName>Ms. Janice D. Jones</preferredName>
> </person>
> 
> And I'm getting the object created and the key set, but none of the
> examples I can find shows a property(?) nested immediately within the
> object, it's always Catalog->Magazine->title so that you're setting
> properties on a child object, then adding the child object to the
> parent.
> 
> Here's the rules.xml file I'm  using:
> 
> <digester-rules>
>    <object-create-rule pattern="person"
>            classname="edu.asu.vpia.dto.custom.PersonViewImpl" />
>    <set-properties-rule pattern="person" >
>       <alias attr-name="key" prop-name="key" />
>    </set-properties-rule>
> 
>    <pattern value="person/preferredName">
>       <call-method-rule pattern="preferredName"
>            methodname="setPreferredName" paramcount="0" />
>    </pattern>
> </digester-rules>
> 
> What should the rule be so that it will call setPreferredName directly
> on the PersonView object?
> 
> Thanks,
> --
> Wendy Smoak
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message