• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

throwing exceptions in JSP

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I'm using error pages to handle html error codes 500 and 400 , when the 500 error is handled i see a NullPointerException generated, so I have this error in web.xml so i can handle the error for the entire module. I ahev tested it in my local machine and also it works in the dev server.
Now, to make sure the error page is reliable , i am testing it and I want to simulate an error situation for which i need to generate a null pointer exception, So is there a way to generate this exception?

Regards,
Keynes.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi you can always thro nullpointer explicitely by using throws clause.
Otherwise do siple step.
Set any object to null and call it's method.
e.g.
String str = null;
str.toString();
this line will throw NullPointerException

Cheers!
 
reply
    Bookmark Topic Watch Topic
  • New Topic