You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Peter Alfors <pe...@irista.com> on 2001/01/31 17:09:48 UTC

Re: Testing equality of bean properties

You could retrieve the bean2:prop2 value into a JSP scriptlet and then pass
it to the logic:equal tag.

<% theValue = yourBean.property2() %>
<logic:equal name="bean1" property="prop1" value="<%=theValue%>">


Lind Jürgen wrote:

> Hi there,
>
> is there a possibbility within a struts-enabled jsp to compare
> two bean properties? I am looking for something like
>
> <logic:equal name="bean1" property="prop1" value=<bean:write name="bean2"
> property="prop2">>
>  ...do something...
> </logic:equal>
>
> which is not possible currently since the logic:equal tag only supports
> comparison between a bean property and and constant value... Any ideas?
>
> Regards,
>
> Jürgen

Re: Testing equality of bean properties

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Peter Alfors wrote:

> You could retrieve the bean2:prop2 value into a JSP scriptlet and then pass
> it to the logic:equal tag.
>
> <% theValue = yourBean.property2() %>
> <logic:equal name="bean1" property="prop1" value="<%=theValue%>">
>

Or, in a similar vein:

    <bean:define id="theValue" name="yourBean" property="property2"/>
    <logic:equal name="bean1" property="prop1" value="<%= theValue %>"/>

Craig