Hi Struts 2 users:

I was wondering if you can use a s:if test based on a pojo's
attribute value:

POJO:

public class Warning{

String text;
String activated; // Y or N

}

JSP:

<s:if test=*"%{warning==null}"*>

--> *Warning* null!

</s:if>

<s:else>

--> *Warning* not null!

--> Activated: <s:property value=*"warning.activated"*/>

<s:if test=*"warning.activated == 'Y' "*>

--> *Warning* *activated*.

</s:if>

<s:else>

--> *Warning* *deactivated*.

</s:else>

</s:else>

The first test (check null value) works OK, but the second always goes
through the else part.

I have tried test=*"%{warning.activated == 'Y' }" and
*test=*"%{#warning.activated
== 'Y' }" *too but it doesnt work either.

I dont know what is wrong, <s:property value=*"warning.activated"*/> shows
the value correctly...



I know I can use an auxiliar boolean variable depending on the value Y/N but
I would like to know why it doesnt work this way.

THANKS IN ADVANCE

Reply via email to