Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Intercepting errors...

Status
Not open for further replies.

HoMyGod

Programmer
Jul 17, 2000
59
CH
Hi,

I wonder how it is possible to intercept errors like:

Exception: java.lang.NullPointerException
java.lang.NullPointerException

I mean, I am using JSP and sometimes, if a user modify manually the URL (for exemple he will modify id=5 into id=tutu) I would like to print an error page...

How can I do that?
 
Hi,

All you need is a try and catch statement. So your jsp would be something like this

try
{
//this will contain all your jsp codes
...
}
catch (NullPointerException e)
{
//code your error page and display it here.
}

Hope this helps,
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 :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top