C
Carse
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.
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.