The nullpointerexception happened because the variable cmd has a null value. When you compare Strings, you cannot compare null value or the nullpointerexception would be thrown.
So what you can do is:-
cmd = request.getParameter("paste"
if (cmd == null)
cmd="";
if (cmd.equals("True") {
Of course this isn't a good way of coding. So normally what we do is to check for all input parameters, whether they are null or not, before carrying on with the processing of other things.
if (abc == null || bcd == null || cmd == null)
// return a response page to the user saying error in page
else
// carry on processing
Regards,
Leon If you need additional help, you can email to me at zaoliang@hotmail.com I don't guaranty that I will be able to solve your problems but I will try my best
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.