displaying error message on the new error.jsp page

A

ashutosh

i m making a project in which i m using jsp as front end, java servlet,
java beans and mysql database.
now when i enter user_id and password on my login screen(jsp page) it
authenticates with the database. if it matches its ok but if not it
displays the sql error message on the internet explorer window. i want
that when such error generates a new jsp page(error.jsp) opens
dynamically and show that error. can anybody suggest which additional
coding (or changes) do i require in my jsp page, servlet or java beans
to implement this concept.
OR u can suggest any valuable link(URL) on internet which can help me.
 
K

kaeli

i m making a project in which i m using jsp as front end, java servlet,
java beans and mysql database.
now when i enter user_id and password on my login screen(jsp page) it
authenticates with the database. if it matches its ok but if not it
displays the sql error message on the internet explorer window. i want
that when such error generates a new jsp page(error.jsp) opens
dynamically and show that error. can anybody suggest which additional
coding (or changes) do i require in my jsp page, servlet or java beans
to implement this concept.
OR u can suggest any valuable link(URL) on internet which can help me.

Depends on how you want to handle it.

Basic JSP: (top of page)
<%@ page isErrorPage="false" errorPage="error.jsp" %>

If you don't want to throw errors all the way up the chain and have to have
the JSP error page figure out what the error was, you may want to set up the
servlet to forward to an error page instead or just write out the error
itself. Also, if part of a response has already been written, the forward
call from either a servlet or the JSP error handler will fail. You can't
forward once ANY response has been sent, including headers. Be careful, as
that can be a gotcha.

Lots of options here depending on architecture and what you want to
accomplish as a whole.

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top