0
 req.getParameter("doit").equal("good");

Is it impossible to write this line in the method? Without it, the program runs correctly. However whenever I write that line, it shows the error messages..

java.lang.NullPointerException at adhoc.FinePrint.doFilter(FinePrint.java:50)

Is there any way that I can check whether "doit" parameter is equal to "good"??

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
BBbbBB
  • 87
  • 7

1 Answers1

2

I'd recommend to turn your equals around to

"good".equals(req.getParameter("doit"));

This prevents the NullPointerException when the request parameter "doit" is not set.

Nitek
  • 2,515
  • 2
  • 23
  • 39