Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

strange problem with boolean to string conversion

Status
Not open for further replies.

developerinlondon

Programmer
Jan 11, 2003
196
GB
I am trying the following code:
Code:
                log_xml = Boolean.getBoolean(request.getParameter("log_xml"));
                logger.info ("log_xml set to :" + log_xml + request.getParameter("log_xml"));

and the output i get is :
log_xml set to :falsetrue

I am passing 'true' as the parameter value. usually it works and its been working in the past without any problem, just suddenly when I made some changes to other parts of the script totally not related to this, it stopped working. any ideas?
 
That getBoolean method looks for system properties.

If you're just trying to transform a String "true" into a Boolean true, use Boolean.valueOf().

Cheers,

Dian
 
thanks. I changed it to be like the following and it seems to work fine now:
Boolean log_xml = new Boolean(request.getParameter("log_xml"));
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top