I have multiple forms which sometimes have similar parts (for instance couple
of fields required for entering the address). For that similar parts I want
to avoid code duplication so I was thinking of doing that by using
freemarker macro orderDataForm with a parameter orderDataObject:

<#macro orderDataForm orderDataObject>
...
<tr>
        <td>Street:</td>
        <td>
                <@s.textfield theme="simple" name="orderDataObject.street" 
                                value="%{orderDataObject.street}" 
cssStyle="width: 200px;"/>
        </td>
</tr>
...
</#macro>

I call that macro with something like this:

<#assign address>
    <@s.property value="user.destinationAddress"/>
</#assign>
<@orderDataForm orderDataObject=address />

I have added the assign before actual call of the macro because user object
is undefined in the first displaying of a form and freemarker complains on
this.
destinationAddress is actually an object with several properties like
street, zipcode, state, ...
When I try this (I have filled destinationAddress fields with some values) I
receive nulls for the destinationAddress properties. Did I miss something?
Or maybe you have a better solution for this kind of issue...








-- 
View this message in context: 
http://www.nabble.com/-s2--Creating-a-part-of-some-form-using-macro-tf4439180.html#a12665754
Sent from the Struts - User mailing list archive at Nabble.com.


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

Reply via email to