• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem Using c:when test  RSS feed

 
Praneet Mirchandani
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,

I want to check for multiple conditions using <c: when test>.

Here is what I have written:



This code never seems to go to the <c:otherwise> part even though I checked for values of A and B.
Where am I going wrong?

Thanks,
Praneet
 
Devaka Cooray
Marshal
Posts: 5325
575
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here, 'null' is a String value. I think you are supposed to use null instead of 'null'. Isn't it?
BTW, Is this code fragment defined in the body of a <c:choose> element?
 
Praneet Mirchandani
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,

It is in <c:choose> element.

I tried both null and "null". It still never goes to <c:otherwise>.


Praneet
 
Sony Agrawal
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Print the value of the object in the <when>.... just to make sure that the value are the way you think
 
Praneet Mirchandani
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

It prints a blank. So I tried this:



Even this doesnt go to the <c:otherwise> element.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you really not indent your code?

Why are you not using the empty operator?

And I assume that this construct is inside a <c:choose> action?
 
Praneet Mirchandani
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do intent my code and this part is in<c:choose>. Probably didnt copy it properly.

I tried using not empty.



This did not work. Do I have to use StringA.value instead?

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ItDoesntWorkIsUseless

What is happening?
 
Praneet Mirchandani
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Basically it never evaluates the <c:otherwise> element when the <c:when test> condition is false.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!