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();
String queryString = request.getQueryString();
<%= requestURL %>+<%= queryString %>
if (queryString.equals("")) {
out.println("is null");
} else {
out.println("not null");
This code works fine so long as there is a query string; if not I get a runtime error on the IF statement. I tried changing queryString definition to request.getQueryString().toString; - but it also fails if there's no queryString.
Perhaps a better question is, how do I properly test for null
Thanks