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,040,783
  • 362
  • 3,548
  • 3,513
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,395
  • 2
  • 22
  • 39