N
nooobody
grz02 said:Hi,
Im an experienced developer, but kinda new to Java...
Just want to know how you practically handle this one.
I have this code line (JSP):
String rqstUserid = (String)request.getParameter("userid");
Now I wanna check if this String is a non-empty, not-null string,
like:
if (rqstUserid != null) && (rqstUserid.length() > 0)
{ ... }
which looks terribly tedious syntax to me,
since you in some other language would just write something like:
if (rqstUserid<>"")
{ ... }
Is there some smarter way (=shorter syntax) to express the test above
in Java, i.e. when you have to account for null values?
you could use the org.apache.commons.validator.GenericValidator
isBlankOrNull(String) method.
But it may be more of a bother to do the import than doing it the way
you already have.