Hi,
Thank you for your quick reply. I tried your suggested syntax and didn't
work either.
However, I like a lot more your last proposal so I will give it a shot.
Thanks!
Oscar

On Tue, Mar 4, 2008 at 1:05 AM, Jeromy Evans <
[EMAIL PROTECTED]> wrote:

> oscar perez wrote:
> >
> > <s:if test="typeCompany.equalsIgnoreCase('CUSTOMER')">
> > <s:set name="companyType" value="%{'customer'}/>
> > ....
> >
> > and then I try to use the proper name in the form tags like that:
> >
> > <s:textfield name="%{companyType}.name" value="%{%{companyType}.name}"/>
> >
> >
> I see what you're trying to do; you're asking OGNL to evaluate
> companyType first, and use the string result in the outer expression to
> evaluate.
>
> The %{} notation won't do this for you.  According to the OGNL guide you
> should use parentheses to evaluate part of the expression as a unit and
> change the evlatulation order [1]
>
> eg
>
> <s:textfield name="%{(companyType).name}" value="%{(companyType).name}"/>
>
> Haven't tried that myself.
>
> see : Parenthetical Expressions
> [1] http://www.ognl.org/basicExpressions.html
>
>
> As a side note though... I don't like your approach.  As your four
> objects share the same interface you should have just one property
> called Enterprise and your form should address that.  Your action should
> implement Preparable and instantiate the appropriate concrete
> implementation prior to the params being set.  If you use the
> params-prepare-params stack you can pass parameters to your action, then
> instantiate the appropriate concrete implementation, then set the
> parameters on the implementation.
>
> regards,
>  Jromy Evans
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to