Hi,

I can't get the relevant error message from the resources file to display
when an exception is thrown.

Can you please help? Here is the scenario:

One of my Action classes, AuthenticateAction, can generate the same type of
application-specific exception (TrcDatabaseException) at various points in
its code.

I want to display error-specific information for each place where the
TrcDatabaseException can be thrown in the AuthenticateAction.

Wherever an exception is thrown in AuthenticateAction, I add some code in
the catch block, before rethrowing it, for example like this:

  } catch(TrcDatabaseException ex){
   /* add relevant action errors */
   ActionErrors errors = new ActionErrors();
   errors.add(ActionErors.GLOBAL_ERROR, new
ActionError("errors.database.noconnection"));
   saveErrors(request, errors);
   /* rethrow the exception to be caught by Struts declarative exception
handling mechanism */
   throw ex;
  }

I have also placed an errors.database.noconnection in the resource file.

In the struts-config file, for the AuthenticateAction, I have defined an
exception element:

<exception
    key="errors.generalmessage"
    type="mydomain.exception.TrcDatabaseException"
    path="/common/exceptionTrcDatabase.jsp"
    />

I have created a JSP, exceptionTrcDatabase.jsp, that contains this element:

    <html:errors/>

However, whenever I test this code (by deliberately creating the relevant
error conditions), only the errors.generalmessage is displayed.

Why isn't the errors.database.noconnection being displayed as well?

Thanks,

Frank.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to