• 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
Sheriffs:
Saloon Keepers:
  • Peter Rooke
Bartenders:

String compare

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HOw to compare a String (JAVA)in jsp with a var in javascript. the var value will be from a field and the comparision should not be case sensitive.....can anyone help me out here
 
Ranch Hand
Posts: 1704
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Amod Mulay:
HOw to compare a String (JAVA)in jsp with a var in javascript. the var value will be from a field and the comparision should not be case sensitive.....can anyone help me out here



You can compare javascript variable with java string but reverse is not possible in JSP.

In javscript convery the variable to upper case and compare. You can use value.toUpperCase() to convert a variable to upper case in Javascript.
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Get the value of java string in one javascript var, and then compare them.
e.g.
var value = yourJavaString;
if(value.toLowerCase() == jsVarToCompare.toLowerCase()) {
//your code
}
 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by IM Mahesh:
Get the value of java string in one javascript var, and then compare them.
e.g.
var value = yourJavaString;
if(value.toLowerCase() == jsVarToCompare.toLowerCase()) {
//your code
}




For more clarity on how to get recieve value in javascript :




Regards,
Jass
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic