velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Choon Chern, Lim" <meteo...@rocketmail.com>
Subject Couldn't retrieve value from Struts bean
Date Thu, 03 Aug 2006 03:00:13 GMT

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


Mime
View raw message