File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Showing Exception Message in client side Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Showing Exception Message in client side" Watch "Showing Exception Message in client side" New topic

Showing Exception Message in client side

yekkala krishna
Ranch Hand

Joined: Mar 04, 2007
Posts: 105

Actually in my servlet i am reading devices from a file.
But when FileNotFoundException occurs i need to see that exception in the jsp page.
how can i show the exception message in jsp?
could any body suggest?

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60082

You can map an error handling page in the deployment descriptor.

But be aware that showing exceptions to uses is generally considered a bad practice. Rather, it is more customary to log the exceptions for the developers, and to show the users a more generic "sorry, but something went wrong" message.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Kumar Raja
Ranch Hand

Joined: Mar 18, 2010
Posts: 516

As Bear suggested, you can configure errors and exceptions in web.xml. Please see the link


With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Showing Exception Message in client side
Similar Threads
Regarding reading a file in a jsp
ArrayList in jsp using JSTL and springs
Reading one line from a text
Regarding xml Data
Loading a file content in dropdown list