Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Exception Handling in JSP Pages using errorpage

843835Jan 9 2002 — edited Jan 11 2002
Hi All,

Could you please let me know what would be the best way to show user friendly message in JSP pages, like "Please enter Employee last name". I am using Jdeveloper 3.2.3. I have created a EditForm to update record into the database table. I want a user-friendly message if any mandatory column is missing (not the client site validation form javascript). I know how to use errorpage etc. I tried the following way to do that :
First method: Store the User Error message in session.setAttribute and try to reterive in errorpage using session.getAttribute. But session.getAttribute is null on the errorpage. Actually when error is happening on the original jsp page its direct to error page without looking into the original page

Second method : Throw the exception in the original page for ex : <% if (request.getParameter("LastName") == null) { throw new Exception("Please enter last name"); } %>;

Even in this case its directly going to error page without looking into the original page. Since exception.getMessage() is giving the exception name etc only.

what could be the better way to do it. Do I need to do the client side validation using Java Script for these cases, and let it go to error page for server side validation and print the exception.getMessage() and printStacktrace() etc.

Please reply ASAP.

Arvind
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 8 2002
Added on Jan 9 2002
2 comments
268 views