I'm building a website, and I was curious about the best way to return to the user that an error has occurred. Here's an example:Check to see if username existsIf it does throw exception back to userI want to architect this properly, but I don't know how. Right now, I have a constructor in an AddUser class. It takes the values from a form and then runs an authenicate() method. I want authenticate() to throw exceptions back to the user if their request fails.Do I do a try{}catch{} in my JSP? Any advice would be great. Thanks.
2/17/2007 11:53:18 PM
try catch is good, then in the catch you can tell it to print an error message to the screen instead of a stack trace.
2/18/2007 11:52:43 AM
Read up on this directive:
<jsp:directive.page errorPage="url"\><%@ page errorPage="url"%>
2/19/2007 12:48:16 PM
I just recently came across this issue - on the best way to notify a user of an exception.In your case, though, I thought that since exceptions were more for program / system errors, they should not be used to communicate issues / notices to users. Application errors and system errors do not equate to user interaction messages.Correct me if I am wrong, but wouldn't a message queue or some kind of message interface to the user be more appropriate means to communicate these kinds of issues?I would also like to hear other's input on both of these delimmas. 1) Architectures for communicating user and application interaction messages and errors2) Architectures for communicating system and application errors (try, catch)[Edited on February 19, 2007 at 1:25 PM. Reason : googling...]
2/19/2007 1:24:48 PM
http://www-128.ibm.com/developerworks/library/j-ejbexcept.htmlIs pretty good.
2/19/2007 1:27:59 PM