Hi Baljinder, The best approach that I know of is to create an Exception for each type of expected error, like a duplicate key in a DAO.
Then create a message in a global message resource for each full class name so that the key is unique. Example, java.lang.Exception=Something bad happened dude Then for every action that throws an error like this configure the input attribute of the <action> tag in struts config. Then your user gets the message on the page which lanched the action. In every action do a try { code } catch (YourException e) { messages.add } and a, if (!messages.isEmpty()) { saveErrors(request, messages); return mapping.getInputForward(); } Of course <html:errors/> must be used in the input jsp. And then your users will understand better what is going on. Good question, other comments are welcome, Phil --- Baljinder Singh <[EMAIL PROTECTED]> wrote: > Hi All, > > I am looking for a robust exception handling > approach in struts. Can > somebody help me in that. My framework consists of > struts interacting with > session beans which then interact with DB through > DAO. Now if during a CRUD > operation, for example there is a duplicate key > exception thrown, how should > I handle it so that I can show the user exact > message that duplicate key is > being inserted. Same for all kind of database > messages and validations. > > Thanks & Regards, > BS > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > ===== Java Web Application Architect mapimage.com - Java and GIS struts1.1:tomcat4.1.27:linuxRH8 __________________________________ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]