Matt,
I'm not sure if this answers your question, but.... You can create a general
exception in the ApplicationResources.properties file, that takes in an
argument. Set the argument when you catch an Exception, such as the
EntityException.
-------------------------------------------
ApplicationResourcesFile with argument {0}
-------------------------------------------
error.server.exception=Server Resources Exception:{0}
------------------------
Action Class
------------------------
catch (EntityException re)
{
// pass the exception argument in the ActionError object
errors.add(ActionErrors.GLOBAL_ERROR, new
ActionError("error.server.exception", re.toString()));
}
Hope this helps,
JD
-----Original Message-----
From: Matt Raible [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 23, 2001 9:55 AM
To: [EMAIL PROTECTED]
Subject: Getting Exception errors from session beans
In my action classes, I am getting a populated JavaBean from my SessionBean,
and I want to know how to get an exception into the errors using
errors.add().
The difference between this and traditional errors is that there is no key
in
ApplicationResource.properties, but rather, I am grabbing a string from the
EntityException.
<code snippet>
// Populate the EntityDO
try
{ EntityDO aEntityDO = new
EntityDO(request.getParameter("id");
InitialContext ctx = new InitialContext();
EntityManagerHome home = (EntityManagerHome)
ctx.lookup(
EntityManagerHome.CLASS_CTX );
EntityManager entityMgr = home.create();
aEntityDO = entityMgr.getEntityDetails(aEntityDO);
}
catch (NamingException ne)
{
log(_className, " NamingException occurred in
getEntityDetails()");
errors.add(ActionErrors.GLOBAL_ERROR, new
ActionError("errors.namingException"));
}
catch (EntityException re)
{
log(_className, " ResourceException occurred in
getResourceDetails()");
// Get EntityException from SessionBean
// *** HELP NEEDED HERE *** //
// How do I get the "re" String into an errors.add
??
}
</code snippent>
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/