• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

validation using comparison operator in jsp

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Let me tell you a story about a man named Jed. He made this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic