wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes Checking a Boolean Value In JavaScript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Checking a Boolean Value In JavaScript" Watch "Checking a Boolean Value In JavaScript" New topic
Author

Checking a Boolean Value In JavaScript

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1490
    
    1
Using the following code it fires the load whether projectFlag equals true or false.

Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Well what you are doing looks to be the correct way to do it, but it is not.

new Boolean("any string") produces true for any string. That means a string that contains false will be evaluated as true

Your only real option here is to do



Eric
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1490
    
    1
Is there any way to pass a boolean value from the servlet back to my JSP using AJAX(jQuery) call?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
if you eval / new Function it

That will cause more problems than just checking for the string.

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Checking a Boolean Value In JavaScript