Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

if else in struts tags

 
Madhu Sudhana
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can we implement the functionality of
if(){}else{} in struts tags???
 
Vani Bandargal
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I recommend to use JSTL tags.

Ex: <c:if>
<c:choose>
 
Madhu Sudhana
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any Struts tags for this???
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The questions you are asking about Struts tags can all be answered by the Struts documentation.

There is a section for each of the various tag libraries in this link. For this question, look for the section entitled "Logic tags".

In answer to your specific question: Strus has an "if" (<logic:equals>) but no "else". That's why Vani and I both recommend using the JSTL tags over the Struts tags in this case.
[ September 11, 2006: Message edited by: Merrill Higginson ]
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With the logic tags you would have to use have to use two pairs of tags. You could use either a html:equal and html:notEqual pair or use a value="true" and value="false" pair. I agree that the JSTL tags are cleaner.

- Brent
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic