File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is my use of c:if correct ?

 
surendar prabu
Ranch Hand
Posts: 102
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
</c:if>
<td><bean:write name="collection" property="property3"/></td>
</logic:iterate>

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.

regards,
Surendar prabu.
 
Purushoth Thambu
Ranch Hand
Posts: 425
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try something like this

[ March 03, 2007: Message edited by: Purushothaman Thambu ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic