Ah ha! You need to change your <form-property name attribute value
from 'webdav.url' to 'webdav'.

The property webdav is an object of some type which contains
a property "url" which is of type string.

I would imagine your form property should be something like:

<form-property name="webdav" type="com.company.proprietaryType"/>

What should happen is that when struts tag is passed the property name
webdav.url, it will access the webdav object and then since you
are using a nested expression, it will invoke getUrl() on the webdav object
which should return a string.


So try changing your form-property name attribute value to 'webdav' and see what 
happens.


Are you trying to prepropulate this field with some value and then allow
the user to override that value? If so, you should do this in the action
which is executed immediately prior to rendering the page. Then your 
html:text tag would look like:

<html:text property="webdav.url"/>

robert




> -----Original Message-----
> From: Ricardo Gladwell [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 06, 2004 10:57 AM
> To: Struts Users Mailing List
> Subject: Re: Problem setting nested bean properties on ActionForms
> 
> 
> Hi Niall,
> 
> My form-bean definition is included below:
> 
> <form-bean
> name="configureForm"
> type="org.apache.struts.action.DynaActionForm">
>          <form-property
>              name="title"
>              type="java.lang.String"
>          />
>          <form-property
>              name="webdav.url"
>              type="java.lang.String"
>          />
> </form-bean>
> 
> -- rg
> 
> Niall Pemberton wrote:
> > If you have
> > 
> >   <html:text property="webdav.url" value="${config.webdav.url}"/>
> > 
> > in your jsp, then Struts (using BeanUtils) will try and do a get("webdav")
> > on your DynaActionForm so that it can then call set("url") on the bean
> > returned from the get.
> > 
> > So when you say "I checked and the property setter method for the
> > DynaActionForm in the example I cited is being called and the 'webdav.url'
> > string is being passed as the property name" - this doesn't seem right to
> > me. If it is being called then its not the Struts form population mechanism
> > thats doing it.
> > 
> > I'm guessing that in your struts config for the DynaActionForm definition
> > you have a property called "webdav.url" - if so then maybe its the form
> > initializtion thats setting "webdav.url" to null. If this is the case then
> > its never going to work this way. You need a "webdav" property that is some
> > kind of bean and then a "url" property in that bean and you somehow need to
> > have that bean set up in your form before the population is done.
> > 
> > If I'm completely off base here then you need to post more information - how
> > about posting the form definition from your struts-config.xml.
> > 
> > Niall
> > 
> > ----- Original Message ----- 
> > From: "Ricardo Gladwell" <[EMAIL PROTECTED]>
> > To: "Jakarta Struts Users" <[EMAIL PROTECTED]>
> > Sent: Friday, August 06, 2004 2:02 PM
> > Subject: Problem setting nested bean properties on ActionForms
> > 
> > 
> > 
> >>Hi All,
> >>
> >>I'm having some problems with nested properties in Strust. Struts seems
> >>to loose property values when specifying nested bean properties in
> >>an action form. For example, the following fragment is an example of
> >>attempting to set a value in a view JSP:
> >>
> >><html:text property="webdav.url" value="${config.webdav.url}"/>
> >>
> >>When Struts attempts to set the webdav.url nested bean property for,
> >>example, a DynaActionForm the value is passed as null to the action form
> >>setter method.
> >>
> >>In the documentation it clearly states that "the property attribute for
> >>the Struts-HTML tags accept simple, nested, and indexed expressions":
> >>
> >>
> > 
> > http://struts.apache.org/api/org/apache/struts/taglib/html/package-summary.html#package_description
> > 
> >>I checked and the property setter method for the DynaActionForm in the
> >>example I cited is being called and the 'webdav.url' string is being
> >>passed as the property name but the property value passed is 'null'
> >>despite the fact that I have entered a value. When I switch to using
> >>standard, non-nested property name values in the html:text tag the
> >>values are set correctly.
> >>
> >>Is this proper behaviour for Struts or is it some kind of bug?
> >>
> >>Kind regards...
> >>
> >>-- Ricardo
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >>
> > 
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to