![]() |
Testing Value of QueryString
Hello,
I'm trying to get the full URL of a webpage and am running into a problem testing the query string. Here's my code so far: Code:
String requestURL = request.getRequestURL().toString();Perhaps a better question is, how do I properly test for null Thanks |
I don't do JSP at all, but you cannot compare queryString.equals if request.getQueryString returns null (this would be common in just regular java of course, but I don't remember if it applies at the JSP level as well). So if the request.getQueryString() can return null, then you simply check that as well:
if (querystring != null) instead of .equals(""). If its not null, then you can then check the .equals("") to see if its empty if desired in the else block. |
Yea, that work. I'd originally tried if (queryString = null) { but was getting a String vs. Boolean mismatch. Hadn't thought of using not instead.
Thanks |
Quote:
if ((stringvar = null) == null)). What would work is if (querystring == null), as that would return true if it is null and false otherwise. |
| All times are GMT +1. The time now is 04:52 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.