Hi, You've got to remember that the operations you're doing have to make logval sense in a Java environment when doing comparisons - particularly string comparisons.
Try this....... #if( $!var.equalsIgnoreCase("string1") && !$!url ) <a href="$url"><img src="image1"></a> #elseif( $!var.equalsIgnoreCase("Yes") && !$!url ) <a href="$url"><img src="image2"></a> #elseif( $!var.equalsIgnoreCase("No") && !$!url ) <a href="$url"><img src="image3"></a> #elseif( !$!url ) <a href="$url"><img src="image4"></a> #else <!-- nothing --> #end You should also be careful about comparing strings to "" when you may well mean null. Steve -----Original Message----- From: John Rodriguez [mailto:[EMAIL PROTECTED] Sent: 31 January 2005 17:03 To: 'Velocity Users List' Subject: compound boolean statements, resent I never received an answer for the following inquiry, any help guys? _____ From: John Rodriguez [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 25, 2005 2:21 PM To: 'velocity-user@jakarta.apache.org' Subject: compound boolean statements How would I state the following correctly in Velocity? #if( $!var == "string1" && $!url != "" ) <a href="$url"><img src="image1"></a> #elseif( $!var == "Yes" && $!url != "" ) <a href="$url"><img src="image2"></a> #elseif( $!var == "No" && $!url != "" ) <a href="$url"><img src="image3"></a> #elseif( $!url != "" ) <a href="$url"><img src="image4"></a> #else <!-- nothing --> #end When I execute this code with var equal to "string1" and url not equal to "", I expect it to execute the 1st block. However, it executes the 4th block instead. Any ideas what I may be doing wrong? Thanks. ---------------------------------------- John Rodriguez New Media Associate Columbia Center for New Media Teaching and Learning (CCNMTL) --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]