velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Will Glass-Husain" <wgl...@forio.com>
Subject Re: Couldn't retrieve value from Struts bean
Date Thu, 03 Aug 2006 03:25:54 GMT
You can't construct a reference like that.  Try

#macro( datetime $var $ref)
       <input type="text" name="$var" value="$ref" />
#end

with a call

#datetime("visitDate" $form.bean.visitDate )

WILL

On 8/2/06, Choon Chern, Lim <meteoric@rocketmail.com> wrote:
>
> Hello,
>
> I'm currently using Struts and Velocity, where the vm
> file gets the Struts ActionForm to populate the form
> fields.
>
> I have a macro as below:-
>
> #macro( datetime $var )
>        <input type="text" name="${var}Date"
> value="$form.bean.${var}Date" />
> #end
>
> I made a call in my HTML as below:-
>
> #datetime(visit)
>
> The associated form bean for this page contains a
> String field called "visitDate".
>
> When the macro resolves, I'm seeing this:-
>
> <input type="text" name="visitDate"
> value="org.meteoric.FrmVisit@32f76519.visitDate" />
>
> It doesn't resolve the value part.
>
> So, I tried hardcoding it this way to test:-
>
> <input type="text" name="visitDate"
> value="$form.bean.visitDate" />
>
> ... and it retrieves the date from the bean and
> display properly in the value property.
>
> How do I fix my macro to achieve my desired result?
>
> Thanks.
>
> Mike
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>


-- 
Forio Business Simulations

Will Glass-Husain
wglass@forio.com
www.forio.com

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


Mime
View raw message