Hi Wes, The solution you provided works. Thanks Windy Hung
________________________________ From: Wes Wannemacher <w...@wantii.com> To: Struts Users Mailing List <user@struts.apache.org> Sent: Sunday, March 15, 2009 8:11:34 AM Subject: Re: Struts Iterator tag and OGNL On Sunday 15 March 2009 10:35:48 Windy Hung wrote: > Hello, > I want to check a property value with a class constant inside iterator tag. > For example, I have a list data type object "products" and I use > <s:iterator value="products"> to loop through it., Inside the looping, I > want to use <s:if test tag to test if the variable "productName" of a > product from products list equals to a class constant variable , for > example, com.abc.product.ProductConstant.LABEL. Or if <s:property value can > do the checking? Can any one help me how to use OGNL to do the checking? > > Thanks > > Windy Hung <s:iterator value="products" var="prod"> <s:if test="#prod.prouctName.equals(@com.abc.product.productconst...@label)"> </s:if> </s:iterator> The key here is using the @ sign to access statics. http://struts.apache.org/2.x/docs/ognl-basics.html#OGNLBasics- Accessingstaticproperties Also note that I'm assuming the productName is a variable of a type that sports a .equals() method that will work when passed the LABEL. Basically, I'm not assuming it's a string. If it is a string comparison, you can probably use eq or == or whatever works on strings. -Wes -- Wes Wannemacher Author - Struts 2 In Practice Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more http://www.manning.com/wannemacher --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org