views:

89

answers:

2

Hi,

I have the following code snippet

<s:iterator status="stat" value="masterAccountList">
                <tr>
                  <td><s:property value="name"/></td>
                  <td><s:property value="status"/></td>
                 <s:set name="DrStat" id="DrStat" value="<s:property value='status'/>"/>
                  <td><s:if test='DrStat.contains("Out")'>
                      Dr. Is Available
                      </s:if>
                      <s:else>
                      Dr. Is not Available
                      </s:else>
                  </td>
                </tr>
            </s:iterator>

I need to check the status if it contains a keyword and display text accordingly. When I try this, I always get 'Not Available' status.

I'm not even sure what the set returns, how can I see that?

+1  A: 

Shouldn't <s:text name="DrStat" /> print the value?

Dustin Digmann
@Dustin, it just prints "DrStat" in all the cells, nothing else :(
Panther24
Sorry, I was trying to do the above from memory. It is actually <s:property ... />.There is an example on the Struts 2 tag libs: http://struts.apache.org/2.0.14/docs/set.html.Also you might change 'name' to 'var' per this same page.
Dustin Digmann
@Dustin, I'm trying it, but I get an error "Attribute var invalid for tag set according to TLD". Any examples?
Panther24
A: 

The solution:

<s:if test="%{DrStat.contains('Out')}">

Work fine. Thanks Dustin.

Panther24