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