You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Kibo <to...@gmail.com> on 2008/03/22 13:26:59 UTC

use continue in

Hi conference

Can I use "continue" in struts tag <s:iterator> ?
----------------------------------------------------------
from:

 for (Category cat : category){   
        	
        	if (cat.getId() == 1)
        			continue;
        	
        	System.out.println(cat.getName());        	        
        }
-----------------------------------------------------------------------------
to:

<s:iterator value="category" status="rowstatus"  >  	
		<s:if test="id == 1">    ?????????????    </s:if>									
		<li><s:property value="name"/></li>	      	     
</s:iterator>
-------------------------------------------------
Thaks for help
Tomas Jurman 
Czech Republic
-- 
View this message in context: http://www.nabble.com/use-continue-in-%3Cs%3Aiterator%3E-tp16219950p16219950.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: use continue in

Posted by Laurie Harper <la...@holoweb.net>.
Laurie Harper wrote:
> Kibo wrote:
>> Hi conference
>>
>> Can I use "continue" in struts tag <s:iterator> ?
>> ----------------------------------------------------------
>> from:
>>
>>  for (Category cat : category){              
>>             if (cat.getId() == 1)
>>                     continue;
>>            
>>             System.out.println(cat.getName());                    
>>         }
>> ----------------------------------------------------------------------------- 
>>
>> to:
>>
>> <s:iterator value="category" status="rowstatus"  >     
>>         <s:if test="id == 1">    ?????????????    
>> </s:if>                                   
>>         <li><s:property value="name"/></li>                   
>> </s:iterator>
>> -------------------------------------------------
> 
> No, that's not supported. You'll need to filter the collection in advance.

... or invert the logic:


<s:iterator value="category" status="rowstatus"  >
     <s:if test="id != 1">
         <li><s:property value="name"/></li>
     </s:if>
</s:iterator>

L.


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


Re: use continue in

Posted by Laurie Harper <la...@holoweb.net>.
Kibo wrote:
> Hi conference
> 
> Can I use "continue" in struts tag <s:iterator> ?
> ----------------------------------------------------------
> from:
> 
>  for (Category cat : category){   
>         	
>         	if (cat.getId() == 1)
>         			continue;
>         	
>         	System.out.println(cat.getName());        	        
>         }
> -----------------------------------------------------------------------------
> to:
> 
> <s:iterator value="category" status="rowstatus"  >  	
> 		<s:if test="id == 1">    ?????????????    </s:if>									
> 		<li><s:property value="name"/></li>	      	     
> </s:iterator>
> -------------------------------------------------

No, that's not supported. You'll need to filter the collection in advance.

L.


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