• Post Reply Bookmark Topic Watch Topic
  • New Topic

validation using comparison operator in jsp  RSS feed

 
shiju nair
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I am using ms-access as backend and jsp.
I am facing a problem in this scenario.I have a page which is displaying the leave balance such as ok.there are two textboxes for dates.i have taken the difference of the two dates in days which is in string value.now what i want is when i click on submit button it should validate the leave balance with the days applied .when a leave is applied for the particular pl,sl,cl the figures goes on decreasing.so when it reaches the person who is applying for leave more than the days in balance it should give him an alert box stating that "you do no have sufficient balance".
please help me .
thanks in advance.
 
shiju nair
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when i am using

but it is giving me error such as


I am trying to do it but i am not getting it.
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I suspect your bal variable is an int and your day variable is a String. The compiler can't convert the String into an int automatically for the < or > check.

You'll need to check that both bal and day are of type int
 
shiju nair
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
so you mean to say if it is not int then i need to convert both of them into int and then validate with the same condition.
please suggest.
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by shiju nair:
hi,
so you mean to say if it is not int then i need to convert both of them into int and then validate with the same condition.
please suggest.


Correct!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!