Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > struts wrapping exceptions mvc

Reply
Thread Tools

struts wrapping exceptions mvc

 
 
Carse
Guest
Posts: n/a
 
      02-18-2005
How do you get a message back to the View layer with declarative
exception handling in an MVC application?

My DAOs are abstracted such that the methods throw
DataAccessExceptions. My business layer catches these and throws
ApplicationExceptions (as described in the book 'Pro Jakarta Struts').
One of the exceptions I want to be displayed to the user is if they
enter a record with a duplicate username. I'll check for this in my
business logic and throw a DuplicateUsernameException, which extends
ApplicationException.

The problem is that the following action exception tag doesn't work in
my struts-config.xml:

<action path="/saveUser"
type="myproj.actions.saveUserAction"
name="userForm"
scope="request"
input="editUser.jsp"
validate="true"
<exception
key="error.userform.duplicateusername"
type="myproj.common.DuplicateUsernameException" />
....
</action>

It only works if I change the exception type to ApplicationException -
which could be a variety of things!

How do I set this up such that it can catch a
DuplicateUsernameException yet still preserve the encapsulation of the
business logic via ApplicationExceptions?

Thank you in advance for your time and assistance.
-Carse.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
No MVC Project Template after installing ASP.NET MVC 1.0 Crazy Cat ASP .Net 1 09-03-2009 08:02 PM
WebForms X MVC? Why MVC? Give me reasons to migrate my web apps to it please. Pros x Cons! Thanks! Paulo ASP .Net 3 12-04-2008 03:00 AM
differences between Spring WebFlow,Spring MVC,and String Portlet MVC? rmn190 Java 2 01-10-2008 02:27 AM
Exceptions in Threads (& MVC) RedGrittyBrick Java 3 11-08-2007 07:34 PM
MVC model for JSP/Servelet without using Struts Edward A Thompson Java 2 07-14-2003 05:40 PM



Advertisments