wood burning stoves
The moose likes Struts and the fly likes Is my use of c:if correct ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Is my use of c:if correct ?" Watch "Is my use of c:if correct ?" New topic

Is my use of c:if correct ?

surendar prabu
Ranch Hand

Joined: Jul 24, 2006
Posts: 102
I am using JSTL c:if to compare values of two properties. But i dont find any difference in the outout. some one pls help me on this. i have given the code below. If this cannot work, then i will go for adding a method to my Action Form which returns me a boolean.

<logic:iterate property="collection1" id="collection" name="MyForm">
<td><bean:write name="collection" property="property1"/></td>
<c:if test="${MyForm.property4 == collection.property2}">
<td><bean:write name="collection" property="property2"/></td>
<td><bean:write name="collection" property="property3"/></td>

Here i have a property4 in my ActionForm MyForm and some properties in the bean reperesented by collection. Now if property4 of MyForm and property2 of collection are equal then only i should draw the 'td' field.
But irrespective of any condition i am getting the output.
Should I use c:forEach instead of struts logic?
please help me on this regard.

Surendar prabu.

SCJP 1.4
Purushoth Thambu
Ranch Hand

Joined: May 24, 2003
Posts: 425
Try something like this

[ March 03, 2007: Message edited by: Purushothaman Thambu ]
I agree. Here's the link: http://aspose.com/file-tools
subject: Is my use of c:if correct ?
jQuery in Action, 3rd edition