You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by netslow <ne...@bk.ru> on 2008/07/29 15:28:30 UTC

Check if object in list (s:iterator additional constraint)

I hello experts. I'm quite new in struts2, and I have a question.
I have an action ShowReports which returns two lists of reports: reports and
badReports.
I would like to show these reports bud I need also check if current report
belongs to badReports list, and if it does notify user about it. What is the
best way to do that?

I want something like that:

<table>
<tr><td>Name</td><td>Title</td></tr>
<s:iterator value="reports">
<s:if test="!(report in badReports)">
<tr>
	<td><s:property value="name"/></td>
	<td><s:property value="title"/></td>
</tr>
</s:if>
<s:else>
<tr>
	<td>bad report!</td>
	<td>bad report!</td>
</tr>
</s:else>
</s:iterator>
</table>

The question is how to check the condition?
Thanks for any advice.

-- 
View this message in context: http://www.nabble.com/Check-if-object-in-list-%28s%3Aiterator-additional-constraint%29-tp18712148p18712148.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Check if object in list (s:iterator additional constraint)

Posted by Gabriel Belingueres <be...@gmail.com>.
Did you tested with 'not in' instead of '!'?

2008/8/5 netslow <ne...@bk.ru>:
>
> People, I'm really confused. I'm still haven't found any solution.
> Any ideas?
>
>
> netslow wrote:
>>
>> I hello experts. I'm quite new in struts2, and I have a question.
>> I have an action ShowReports which returns two lists of reports: reports
>> and badReports.
>> I would like to show these reports bud I need also check if current report
>> belongs to badReports list, and if it does notify user about it. What is
>> the best way to do that?
>>
>> I want something like that:
>>
>> <table>
>> <tr><td>Name</td><td>Title</td></tr>
>> <s:iterator value="reports">
>> <s:if test="!(report in badReports)">
>> <tr>
>>       <td><s:property value="name"/></td>
>>       <td><s:property value="title"/></td>
>> </tr>
>> </s:if>
>> <s:else>
>> <tr>
>>       <td>bad report!</td>
>>       <td>bad report!</td>
>> </tr>
>> </s:else>
>> </s:iterator>
>> </table>
>>
>> The question is how to check the condition?
>> Thanks for any advice.
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Check-if-object-in-list-%28s%3Aiterator-additional-constraint%29-tp18712148p18831733.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Check if object in list (s:iterator additional constraint)

Posted by netslow <ne...@bk.ru>.
People, I'm really confused. I'm still haven't found any solution.
Any ideas?


netslow wrote:
> 
> I hello experts. I'm quite new in struts2, and I have a question.
> I have an action ShowReports which returns two lists of reports: reports
> and badReports.
> I would like to show these reports bud I need also check if current report
> belongs to badReports list, and if it does notify user about it. What is
> the best way to do that?
> 
> I want something like that:
> 
> <table>
> <tr><td>Name</td><td>Title</td></tr>
> <s:iterator value="reports">
> <s:if test="!(report in badReports)">
> <tr>
> 	<td><s:property value="name"/></td>
> 	<td><s:property value="title"/></td>
> </tr>
> </s:if>
> <s:else>
> <tr>
> 	<td>bad report!</td>
> 	<td>bad report!</td>
> </tr>
> </s:else>
> </s:iterator>
> </table>
> 
> The question is how to check the condition?
> Thanks for any advice.
> 
> 

-- 
View this message in context: http://www.nabble.com/Check-if-object-in-list-%28s%3Aiterator-additional-constraint%29-tp18712148p18831733.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org