Displaying errors in JSP
If I have a code block such as % try { } catch (Exception e) { } % inside a JSP, how do I output error to either the browser or to the server console ? -- Vinay Vaze M/S : 7H-80 Phone : (425)-865-2929 Email : [EMAIL PROTECTED]
RE: Displaying errors in JSP
for the terminal, you can use System.out.println(e.getMessage()) in the catch phrase for the jsp, you will need to initialize some string variable in the catch block and then use in the html ... % String error = ; try { } catch (Exception e){ error = e.getMessage(); } % ...html stuff p%=error%/p But this isn't really always necessary. Orion will spit out the error in the jsp if you don't catch it...since there is a try/catch built around every jsp page. Try it...do something silly in the jsp page to create a Null Pointer Error, and watch the fireworks in the browser. As long as you don't have a 500 error page, your jsp Null Pointer Error will be in the browser. regards, the elephantwalker www.elephantwalker.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of EXT-Vaze, Vinay G Sent: Wednesday, October 03, 2001 9:09 AM To: Orion-Interest Subject: Displaying errors in JSP If I have a code block such as % try { } catch (Exception e) { } % inside a JSP, how do I output error to either the browser or to the server console ? -- Vinay Vaze M/S : 7H-80 Phone : (425)-865-2929 Email : [EMAIL PROTECTED]
RE: Displaying errors in JSP
BTW, if you use IE, disable 'friendly HTTP error messages'. This option, in its active state will prevent the error page to display in the browser. JP -Original Message- From: The elephantwalker [mailto:[EMAIL PROTECTED]] Sent: MiƩrcoles, 03 de Octubre de 2001 13:21 To: Orion-Interest Subject: RE: Displaying errors in JSP for the terminal, you can use System.out.println(e.getMessage()) in the catch phrase for the jsp, you will need to initialize some string variable in the catch block and then use in the html ... % String error = ; try { } catch (Exception e){ error = e.getMessage(); } % ...html stuff p%=error%/p But this isn't really always necessary. Orion will spit out the error in the jsp if you don't catch it...since there is a try/catch built around every jsp page. Try it...do something silly in the jsp page to create a Null Pointer Error, and watch the fireworks in the browser. As long as you don't have a 500 error page, your jsp Null Pointer Error will be in the browser. regards, the elephantwalker www.elephantwalker.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of EXT-Vaze, Vinay G Sent: Wednesday, October 03, 2001 9:09 AM To: Orion-Interest Subject: Displaying errors in JSP If I have a code block such as % try { } catch (Exception e) { } % inside a JSP, how do I output error to either the browser or to the server console ? -- Vinay Vaze M/S : 7H-80 Phone : (425)-865-2929 Email : [EMAIL PROTECTED]
RE: Displaying errors in JSP
System.out.print() - server console out.print() - HTML page -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of EXT-Vaze, Vinay G Sent: Wednesday, October 03, 2001 12:09 To: Orion-Interest Subject: Displaying errors in JSP If I have a code block such as % try { } catch (Exception e) { } % inside a JSP, how do I output error to either the browser or to the server console ? -- Vinay Vaze M/S : 7H-80 Phone : (425)-865-2929 Email : [EMAIL PROTECTED]
Re: Displaying errors in JSP
Response Inlined. EXT-Vaze, Vinay G wrote: If I have a code block such as % try { } catch (Exception e) { e.printStackTrace(); //This should write the stack trace of the exception to the console. } % inside a JSP, how do I output error to either the browser or to the server console ? -- Vinay Vaze M/S : 7H-80 Phone : (425)-865-2929 Email : [EMAIL PROTECTED] -- Stephen Davidson Java Consultant Delphi Consultants, LLC http://www.delphis.com Phone: 214-696-6224 x208