I may be misunderstanding your situation completely. If
I have, I apologize ahead of time. Here's the short
version of what I think.
Can you not throw more specific exceptions, ones that
imply a little more about what went wrong? Then setup
exception elements in the global section (or in the
Action mappings if they are specific to the Action) and
configure the application resource key for that specific
exception.
I'm sure you understand this, but let me emphasize
anyway, the point of declarative exception handling is
that you shouldn't have to do anything programmatically
to display errors. You specify what the error page is
using the "path" attribute in the exception element. In
your case, since you want all errors to go to the same
page, the path attribute would be "error.jsp" for all of
your exception elements.
Does that make sense? Again, let me know if I
misunderstood the question completely.
Chuck
> Chuck,
>
> I have gone through this chapter but I didn't find anyway to retrieving key
> during run time for declarative exception handling. My requirement is to
> maintain single error.jsp file, and hence the error key should not be
> hardcoded. I am specifying a global exception, say, java.lang.Exception and
> for two different situation and I am throwing new Exception("key1"), and new
> Exception(key2). I would love to get key (key1 or key2) in runtime and
> replacing it will appropriate messages from ApplicationResources.properties
> file. Please point out if I missed sth in chapter 10 and there is a way to
> handle the situation I mentioned above.
>
> Thanks,
> Harvinder
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Monday, October 07, 2002 5:50 PM
> To: Struts Users Mailing List
> Subject: Re: Declarative Exception handling with Struts 1.1-b2
>
>
> If you haven't already, may I suggest you download the
> draft of Chapter 10 from my book. It covers Struts and
> Exception Handling (both programmatic and declarative).
>
> Here's a link:
> http://www.theserverside.com/resources/strutsreview.jsp
>
> Sorry for the shameless plug, but I think the material
> will help.
>
> Chuck
> > Hi,
> > Can anybody help me in understanding declarative exception handling with
> > Struts1.1b2? My requirement is maintaining only single "error.jsp" file,
> > which should be displayed when an exception is thrown. We are having
> multiple
> > exception classes and when an exception is thrown an error id is associated
> > with it to get appropriate message. If I put all the error code vs error
> > messages in ApplicationResources.properties, there should be a way to fetch
> > the error code from the thrown exception, and then displaying the
> appropriate
> > message. Any help is appriciated.
> > Thanks,
> > Harvinder
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>