• Post Reply Bookmark Topic Watch Topic
  • New Topic

regarding c:if  RSS feed

 
Praful Thakare
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I came acrross follwoing problem in getting correct result for values >=100

here it goes the following if statement gives me true


o/p
99 19 true
where as following gives me false


O/P
100 19 false

kindly let me know the solution,if I need to use integer types,then HOW TO ?

Cheers
-Praful
 
Praful Thakare
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Am I the only one on this earth to face this problem ??

JSTL Gurus kindly help out ....

-P
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its really wiered.
Have you tried the same code with some other machine?
Let me try and get back to you. What else I can say.
 
Praful Thakare
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its really wiered.

I know it is, and the solution is more wiered...

I did following for defining maxRecord
<c:set var="maxRecord" value="${100+0}"/>

Well now my problem is solved,but itz kind of untidey way to do it...
still waiting for some to show me correct way ...

Cheers
-Praful
[ March 09, 2005: Message edited by: Praful Thakare ]
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Praful Thakare:
<c:set var="maxRecord" value="${100+0}"/>


Hey whats that. It means 99+1 would also work.
 
Praful Thakare
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My code was as follows

<c:set var="maxRecord" value="${MaximumRecord}"/>

where MaximumRecord is session variable,so I thought

JSTL might consider it as

String maxRecord=(String) session.getAttribute("MaximumRecord");

hence by adding +0 I tried telling JSTL that MaximumRecord is of Numeric Type and it actully worked !!! Lucky me

N ya 99+1 should work as well....not sure thou.

-Praful
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Praful Thakare:
My code was as follows

<c:set var="maxRecord" value="${MaximumRecord}"/>

where MaximumRecord is session variable,so I thought

JSTL might consider it as

String maxRecord=(String) session.getAttribute("MaximumRecord");


Why you didn't post the actual code?

Anyways, please try to <c ut> MaximumRecord, then we will know for sure what was happening actually. Whether, MaximumRecord is considered as String or Object or something else.
[ March 10, 2005: Message edited by: Adeel Ansari ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!