Re: ExceptionHandler not able to display error messages

2003-11-21 Thread Pratik Patel

I have written an ExceptionHandler that extends the struts exceptionHandler.

I would like it to print a stack trace. So, I have done the following:
have a look at this blog entry, and the ExceptionHandler and JSP page I 
use for displaying exception messages (and stacktraces)

http://www.jroller.com/page/prpatel/20031023#handling_the_three_kinds_of

HTH,
Pratik


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


ExceptionHandler not able to display error messages

2003-11-20 Thread Sharmila Pandith
Hi,

I have written an ExceptionHandler that extends the struts exceptionHandler.

I would like it to print a stack trace. So, I have done the following:

In ln1, I add the config.getKey to errors. It prints out the value associated
to the key.
In Ln4, I have added an Action error with the key and the deatiled message.
However, only the value associated with the key gets printed and the message
doesn't.
How can I get that to print as well?

Ln1: errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(config.getKey()));
Ln2:while (exception != null) {
Ln3:errors.add(ActionErrors.GLOBAL_ERROR,
Ln4: new ActionError(error.detail,
exception.getMessage()));
Ln5:exception = (Exception) exception.getCause();
Ln6:}
//Store the errors and exception
Ln8:request.setAttribute(Globals.ERROR_KEY, errors);

TX,
S P

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



Re: ExceptionHandler not able to display error messages

2003-11-20 Thread Daniel A. Torrey
What does the errors.detail string look like?  Do you have a replacement
parameter in it for exception.getMessage() to be inserted into?

-daniel

Daniel A. Torrey
daniel at datorrey dot net



Quoting Sharmila Pandith [EMAIL PROTECTED]:

 Hi,
 
 I have written an ExceptionHandler that extends the struts exceptionHandler.
 
 I would like it to print a stack trace. So, I have done the following:
 
 In ln1, I add the config.getKey to errors. It prints out the value associated
 to the key.
 In Ln4, I have added an Action error with the key and the deatiled message.
 However, only the value associated with the key gets printed and the message
 doesn't.
 How can I get that to print as well?
 
 Ln1: errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(config.getKey()));
 Ln2:  while (exception != null) {
 Ln3:  errors.add(ActionErrors.GLOBAL_ERROR,
 Ln4:   new ActionError(error.detail,
 exception.getMessage()));
 Ln5:  exception = (Exception) exception.getCause();
 Ln6:  }
   //Store the errors and exception
 Ln8:  request.setAttribute(Globals.ERROR_KEY, errors);
 
 TX,
 S P
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

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



ExceptionHandler

2003-11-18 Thread Sharmila Pandith
Hi,

I have the following defined in my config:
action
path=/buildCRAction
type=com.hnw.apps.ml.clients.action.BuildContentReleaseAction
validate=false
name=contentReleaseForm
input=/build_content_release.jsp
scope=request 
exception 
key=error.content.release.contentmanager.exception 
path=/systemError 
 
type=com.hnw.services.content.exception.ContentManagerException /
exception 
key=error.content.release.create.fail 
path=/build_content_release.jsp 
 
type=com.hnw.services.content.exception.CreateContentReleaseException /
forward name=success path=/viewCRAction.do /
/action  

My action class complains that I am not catching these exceptions. 

Should I extend the ExceptionHandler for this to work?

s P

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



RE: ExceptionHandler

2003-11-18 Thread Yee, Richard K,,DMDCWEST
Felipe,
How is '/componentes/mensagens.jsp' related to the Action or to
'tiles.erro'? When do you get this message vs. the blank white page? Have
you viewed the source of the 'white page' to see if it contains any html?

-Richard



-Original Message-
From: Felipe Nascimento [mailto:[EMAIL PROTECTED] 
Sent: Sunday, November 16, 2003 9:09 PM
To: Struts Users Mailing List
Subject: Re: ExceptionHandler


Yes it is. I am from Brazil. It is in portuguese.
Tks.
- Original Message - 
From: Rick Reumann [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Monday, November 17, 2003 2:39 AM
Subject: Re: ExceptionHandler


 Felipe Nascimento wrote:

  key=tatilJ.exception.faseJaExisteException path=tiles.erro /

 Is the tiles definition really called tiles.erro and not 
 tiles.error ?

 --
 Rick



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





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

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



ExceptionHandler example

2003-11-18 Thread Sharmila Pandith
Hi,

Can anyone please send me an example for ExceptionHandler? I need to to know
what goes in teh config file, the action class and the other files.

TX,
S P

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



RE: ExceptionHandler example

2003-11-18 Thread Yee, Richard K,,DMDCWEST
Check this article out:
http://javaboutique.internet.com/tutorials/excep_struts/index-7.html

-Richard

-Original Message-
From: Sharmila Pandith [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 18, 2003 3:34 PM
To: [EMAIL PROTECTED]
Subject: ExceptionHandler example


Hi,

Can anyone please send me an example for ExceptionHandler? I need to to know
what goes in teh config file, the action class and the other files.

TX,
S P

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

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



ExceptionHandler

2003-11-16 Thread Felipe Nascimento
Hi,

I am trying to use the exception handling from default struts
ExceptionHandler.
I declared this inside a action tag in struts config.xml :

exception type=br.com.tatil.tatilj.exception.FaseJaExisteException
key=tatilJ.exception.faseJaExisteException path=tiles.erro /

1- I was always getting the white screen. So I put the input property in
the action tag. It started going to the input I declared, but what I wanted
was to go to the path declared above (tiles one).
2- Beside, I get: [ServletException in:/componentes/mensagens.jsp] Cannot
find bean error in any scope' .

Any clue???

Tks a lot,
Felipe.



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



Re: ExceptionHandler

2003-11-16 Thread Felipe Nascimento
Yes it is. I am from Brazil. It is in portuguese.
Tks.
- Original Message - 
From: Rick Reumann [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Monday, November 17, 2003 2:39 AM
Subject: Re: ExceptionHandler


 Felipe Nascimento wrote:

  key=tatilJ.exception.faseJaExisteException path=tiles.erro /

 Is the tiles definition really called tiles.erro and not tiles.error ?

 -- 
 Rick



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





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



ExceptionHandler to ActionError

2003-11-13 Thread Nathan Coast
Hi

I'd like to catch exceptions in an exception handler and then re-use the 
ActionMessage mechanism to relay messages to the failed input page.  Is this 
possible?  What do I have to do within the ExceptionHandler to invoke the 
ActionMessage mechanism?

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


RE: ExceptionHandler to ActionError

2003-11-13 Thread Norm Deane
Assuming you want to do this to make use of the html:messages tag... The
default ExceptionHandler (org.apache.struts.action.ExceptionHandler) creates
an ActionErrors object which encapsulates the error message derived from the
Exception and the ExceptionConfig.  By nature of the inheritance
relationship an ActionErrors is an ActionMessages.  Therefor you can use the
html:messages tag with the ActionErrors created by the ExceptionHandler.

In your page you can iterate over the ActionErrors created by the
ExceptonHandler like so...

html:messages id=error
   lic:out value=${error} escapeXml=false//li
/html:messages

By default the messages tag will iterate over the ActionErrors rather than
the ActionMessages which is what you want in this case since
ExceptionHandler created and stored them as ActionErrors.

-- 
Norm Deane
MIS Consultant
Vanderbilt University
(615) 322-7855
[EMAIL PROTECTED] 

 -Original Message-
 From: Nathan Coast [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, November 13, 2003 4:20 AM
 To: Struts Users Mailing List
 Subject: ExceptionHandler to ActionError
 
 
 Hi
 
 I'd like to catch exceptions in an exception handler and then 
 re-use the 
 ActionMessage mechanism to relay messages to the failed input 
 page.  Is this 
 possible?  What do I have to do within the ExceptionHandler 
 to invoke the 
 ActionMessage mechanism?
 
 thanks
 Nathan
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


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



RE: Is there a nice ExceptionHandler mechanism in struts for Throwable?

2003-09-24 Thread Mathew, Manoj
Hi

  I am handling it myself in my project..All my action throws exception and i have 
this in my struts config.
!-- == Exception Processing Configuration == --
global-exceptions
exception key=systemError type=java.lang.Exception 
handler=com.vv.bb.bb.nn.mm.MyExceptionHandler /
/global-exceptions


then in  MyExceptionHandler.java,


public class MyExceptionHandler extends org.apache.struts.action.ExceptionHandler {

public ActionForward execute(Exception ex, org.apache.struts.config.ExceptionConfig 
ae, org.apache.struts.action.ActionMapping mapping, 
org.apache.struts.action.ActionForm formInstance, 
javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse 
response) throws javax.servlet.ServletException {

...you code to handle it

.
}}

hope this will help you..
If anybody has a better way please let us know.
manoj



-Original Message-
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 23, 2003 7:41 PM
To: Struts Users Mailing List
Subject: Re: Is there a nice ExceptionHandler mechanism in struts for
Throwable?


Alex Shneyderman wrote:

I have looked at ExceptionHnadlers and find them pretty nifty.
Is there a way to do similar thingy with Throwables?

I tried to set ExceptionHandler to catch (type attribute) 
Java.lang.Throwable but it does not work and I get the ugly
ServletException as my page to the user?
  

Although it would have been possible to design the existing mechanism to 
support Throwables, it's generally considered bad form to try to deal 
with them -- after all, it's things like OutOfMemoryError and the like, 
and it is not normally something a webapp can recover from.  Are there 
particular Throwables that are not Exceptions that you are interested in 
dealing with yourself?

Thanks,
Alex.

Craig



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


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



Is there a nice ExceptionHandler mechanism in struts for Throwable?

2003-09-23 Thread Alex Shneyderman

I have looked at ExceptionHnadlers and find them pretty nifty.
Is there a way to do similar thingy with Throwables?

I tried to set ExceptionHandler to catch (type attribute) 
Java.lang.Throwable but it does not work and I get the ugly
ServletException as my page to the user?

Thanks,
Alex.


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



Re: Is there a nice ExceptionHandler mechanism in struts for Throwable?

2003-09-23 Thread Craig R. McClanahan
Alex Shneyderman wrote:

I have looked at ExceptionHnadlers and find them pretty nifty.
Is there a way to do similar thingy with Throwables?
I tried to set ExceptionHandler to catch (type attribute) 
Java.lang.Throwable but it does not work and I get the ugly
ServletException as my page to the user?
 

Although it would have been possible to design the existing mechanism to 
support Throwables, it's generally considered bad form to try to deal 
with them -- after all, it's things like OutOfMemoryError and the like, 
and it is not normally something a webapp can recover from.  Are there 
particular Throwables that are not Exceptions that you are interested in 
dealing with yourself?

Thanks,
Alex.
Craig



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


Re: ExceptionHandler storing ActionErrors in session

2003-09-04 Thread Jing Zhou
When the declarative exception handling was introduced, I was very
concerned about the scope attribute in the ExceptionConfig. It is a
redundant
attribute if we obey the following rules:
1) All exceptions that could reach to the exception handler should be
fatal errors.
2) Fatal errors should be consumed and/or logged in the current thread.

The ErrorsTag, MessagesTag, and utility classes were correctly
designed to handle request scoped ActionErrors. And the rules are
consistent with the servlet engines' error handling mechanism:
Any system errors will be output and/or logged in the current thread.
Further more, any fatal/system errors from EJB and database must
be reported during one invoking method (also in one thread).
So in 99% use cases, you do not need to store ActionErrors
in the session scope.

If the scope attribute was removed, then some bug reports regarding to
the exception handling would not be there. Forgetting about session
is the *cleanest* solution from my point of view.

If the 1% users REALLY want to store ActionErrors in the session scope,
they could extend the base exception handler class with the following
questions to be answered:

1) When an object is stored in a session, the object should serve some
purposes across request threads. If fatal errors do not get handled
in the current thread and stored in the session, which later request
thread will take care of them?
2) If non-fatal errors are stored in a session and some later request
threads may be interested in the non-fatal errors and make decision
based on them, then consider do the non-fatal *errors* really
qualify as errors? In other words, should they be caught or processed
within the Action.execute() method and stored as business objects?

It is very likely to over kill a problem if session scoped ActionErrors
are used. It only gives you more troubles than problems solved.

Jing
Netspread Carrier
http://www.netspread.com


- Original Message - 
From: Robert Taylor [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, September 03, 2003 1:58 PM
Subject: ExceptionHandler storing ActionErrors in session


 I'm just starting to fiddle around with ExceptionHandlers and was
wondering
 how and when ActionErrors are removed from session scoped if configured to
 be stored there.

 I took a look at the ErrorsTag and the MessagesTag (because I'm assuming
 these tags would be used to render the ActionErrors) and didn't see
 provisions for removing ActionErrors from session scope.

 I must have missed something obvious here and would appreciate anyone who
 could point me in the right direction.

 robert


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




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



ExceptionHandler storing ActionErrors in session

2003-09-03 Thread Robert Taylor
I'm just starting to fiddle around with ExceptionHandlers and was wondering
how and when ActionErrors are removed from session scoped if configured to
be stored there.

I took a look at the ErrorsTag and the MessagesTag (because I'm assuming
these tags would be used to render the ActionErrors) and didn't see
provisions for removing ActionErrors from session scope.

I must have missed something obvious here and would appreciate anyone who
could point me in the right direction.

robert


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



Re: ExceptionHandler storing ActionErrors in session

2003-09-03 Thread David Graham
I don't believe there is currently a way to remove messages from the
session.  How would Struts know when to remove them?  I have written a
small subclass of ActionMessages that only returns its messages once. 
This allows me to store messages in the session without them being
displayed multiple times.  

You're not the first person to need this feature so maybe it's time to
float the subclass idea on struts-dev (unless there is a better way).

David


--- Robert Taylor [EMAIL PROTECTED] wrote:
 I'm just starting to fiddle around with ExceptionHandlers and was
 wondering
 how and when ActionErrors are removed from session scoped if configured
 to
 be stored there.
 
 I took a look at the ErrorsTag and the MessagesTag (because I'm assuming
 these tags would be used to render the ActionErrors) and didn't see
 provisions for removing ActionErrors from session scope.
 
 I must have missed something obvious here and would appreciate anyone
 who
 could point me in the right direction.
 
 robert
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



RE: ExceptionHandler storing ActionErrors in session

2003-09-03 Thread Mike Jasnowski
What about adding a symmetrical removeErrors()/removeMessages() to Action?

-Original Message-
From: David Graham [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 03, 2003 5:21 PM
To: Struts Users Mailing List
Subject: Re: ExceptionHandler storing ActionErrors in session


I don't believe there is currently a way to remove messages from the
session.  How would Struts know when to remove them?  I have written a
small subclass of ActionMessages that only returns its messages once. 
This allows me to store messages in the session without them being
displayed multiple times.  

You're not the first person to need this feature so maybe it's time to
float the subclass idea on struts-dev (unless there is a better way).

David


--- Robert Taylor [EMAIL PROTECTED] wrote:
 I'm just starting to fiddle around with ExceptionHandlers and was
 wondering
 how and when ActionErrors are removed from session scoped if configured
 to
 be stored there.
 
 I took a look at the ErrorsTag and the MessagesTag (because I'm assuming
 these tags would be used to render the ActionErrors) and didn't see
 provisions for removing ActionErrors from session scope.
 
 I must have missed something obvious here and would appreciate anyone
 who
 could point me in the right direction.
 
 robert
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



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



RE: ExceptionHandler storing ActionErrors in session

2003-09-03 Thread Robert Taylor
David,

Thanks for responding.

Yep. I ended up subclassing MessagesTag so that it removes any messages
that might exist in the session once the message has been rendered.

robert

 -Original Message-
 From: David Graham [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, September 03, 2003 5:21 PM
 To: Struts Users Mailing List
 Subject: Re: ExceptionHandler storing ActionErrors in session


 I don't believe there is currently a way to remove messages from the
 session.  How would Struts know when to remove them?  I have written a
 small subclass of ActionMessages that only returns its messages once.
 This allows me to store messages in the session without them being
 displayed multiple times.

 You're not the first person to need this feature so maybe it's time to
 float the subclass idea on struts-dev (unless there is a better way).

 David


 --- Robert Taylor [EMAIL PROTECTED] wrote:
  I'm just starting to fiddle around with ExceptionHandlers and was
  wondering
  how and when ActionErrors are removed from session scoped if configured
  to
  be stored there.
 
  I took a look at the ErrorsTag and the MessagesTag (because I'm assuming
  these tags would be used to render the ActionErrors) and didn't see
  provisions for removing ActionErrors from session scope.
 
  I must have missed something obvious here and would appreciate anyone
  who
  could point me in the right direction.
 
  robert
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 


 __
 Do you Yahoo!?
 Yahoo! SiteBuilder - Free, easy-to-use web site design software
 http://sitebuilder.yahoo.com

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



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



RE: ExceptionHandler storing ActionErrors in session

2003-09-03 Thread David Graham
--- Mike Jasnowski [EMAIL PROTECTED] wrote:
 What about adding a symmetrical removeErrors()/removeMessages() to
 Action?

How would your Action know to call that?  How would your app know which
Action was executed after the one that generated the messages?

David

 
 -Original Message-
 From: David Graham [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, September 03, 2003 5:21 PM
 To: Struts Users Mailing List
 Subject: Re: ExceptionHandler storing ActionErrors in session
 
 
 I don't believe there is currently a way to remove messages from the
 session.  How would Struts know when to remove them?  I have written a
 small subclass of ActionMessages that only returns its messages once. 
 This allows me to store messages in the session without them being
 displayed multiple times.  
 
 You're not the first person to need this feature so maybe it's time to
 float the subclass idea on struts-dev (unless there is a better way).
 
 David
 
 
 --- Robert Taylor [EMAIL PROTECTED] wrote:
  I'm just starting to fiddle around with ExceptionHandlers and was
  wondering
  how and when ActionErrors are removed from session scoped if
 configured
  to
  be stored there.
  
  I took a look at the ErrorsTag and the MessagesTag (because I'm
 assuming
  these tags would be used to render the ActionErrors) and didn't see
  provisions for removing ActionErrors from session scope.
  
  I must have missed something obvious here and would appreciate anyone
  who
  could point me in the right direction.
  
  robert
  
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
 
 
 __
 Do you Yahoo!?
 Yahoo! SiteBuilder - Free, easy-to-use web site design software
 http://sitebuilder.yahoo.com
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



RE: ExceptionHandler storing ActionErrors in session

2003-09-03 Thread David Graham
--- Robert Taylor [EMAIL PROTECTED] wrote:
 David,
 
 Thanks for responding.
 
 Yep. I ended up subclassing MessagesTag so that it removes any messages
 that might exist in the session once the message has been rendered.

That's what I did too but changed to the ActionMessages subclass.  I
floated that idea some time ago and the consensus seemed to be that custom
tags shouldn't be altering session state.

David

 
 robert
 
  -Original Message-
  From: David Graham [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, September 03, 2003 5:21 PM
  To: Struts Users Mailing List
  Subject: Re: ExceptionHandler storing ActionErrors in session
 
 
  I don't believe there is currently a way to remove messages from the
  session.  How would Struts know when to remove them?  I have written a
  small subclass of ActionMessages that only returns its messages once.
  This allows me to store messages in the session without them being
  displayed multiple times.
 
  You're not the first person to need this feature so maybe it's time to
  float the subclass idea on struts-dev (unless there is a better way).
 
  David
 
 
  --- Robert Taylor [EMAIL PROTECTED] wrote:
   I'm just starting to fiddle around with ExceptionHandlers and was
   wondering
   how and when ActionErrors are removed from session scoped if
 configured
   to
   be stored there.
  
   I took a look at the ErrorsTag and the MessagesTag (because I'm
 assuming
   these tags would be used to render the ActionErrors) and didn't see
   provisions for removing ActionErrors from session scope.
  
   I must have missed something obvious here and would appreciate
 anyone
   who
   could point me in the right direction.
  
   robert
  
  
  
 -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
 
 
  __
  Do you Yahoo!?
  Yahoo! SiteBuilder - Free, easy-to-use web site design software
  http://sitebuilder.yahoo.com
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



RE: ExceptionHandler storing ActionErrors in session

2003-09-03 Thread Mike Jasnowski
How would your Action know to call that?  How would your app know which
Action was executed after the one that generated the messages?

I would expect the same way an Action determines that it needs to call
saveErrors(), if there are errors in the collection. The Action makes the
determination on whether errors exist and need to be passed to a JSP or
another action. The next action that is invoked may or may not care about
these errors, and calls removeXXX(). That is a bit of a pain I would agree
to have to explicitly make a call to removeErrors() you don't care about.

But how does the tag know whether it should clear them out after one use?
At least with the action the user then has more precise control over when
the messages are cleared.

That said, there may not be many, if any, cases of having to carry messages
past one use. But for example in an application where you have recorded some
errors/messages, but allow the user to continue on. And the messages are
shown persistently at the top of a page or in some other frame, Once the
user decides to clear the errors/messages, an Action would then call the
removeXXX() method.

Mike Jasnowski

-Original Message-
From: David Graham [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 03, 2003 5:34 PM
To: Struts Users Mailing List
Subject: RE: ExceptionHandler storing ActionErrors in session


--- Mike Jasnowski [EMAIL PROTECTED] wrote:
 What about adding a symmetrical removeErrors()/removeMessages() to
 Action?

How would your Action know to call that?  How would your app know which
Action was executed after the one that generated the messages?

David


 -Original Message-
 From: David Graham [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, September 03, 2003 5:21 PM
 To: Struts Users Mailing List
 Subject: Re: ExceptionHandler storing ActionErrors in session


 I don't believe there is currently a way to remove messages from the
 session.  How would Struts know when to remove them?  I have written a
 small subclass of ActionMessages that only returns its messages once.
 This allows me to store messages in the session without them being
 displayed multiple times.

 You're not the first person to need this feature so maybe it's time to
 float the subclass idea on struts-dev (unless there is a better way).

 David


 --- Robert Taylor [EMAIL PROTECTED] wrote:
  I'm just starting to fiddle around with ExceptionHandlers and was
  wondering
  how and when ActionErrors are removed from session scoped if
 configured
  to
  be stored there.
 
  I took a look at the ErrorsTag and the MessagesTag (because I'm
 assuming
  these tags would be used to render the ActionErrors) and didn't see
  provisions for removing ActionErrors from session scope.
 
  I must have missed something obvious here and would appreciate anyone
  who
  could point me in the right direction.
 
  robert
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 


 __
 Do you Yahoo!?
 Yahoo! SiteBuilder - Free, easy-to-use web site design software
 http://sitebuilder.yahoo.com

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



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



__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



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



RE: ExceptionHandler storing ActionErrors in session

2003-09-03 Thread Mike Jasnowski
I would expect the same way an Action determines that it needs to call
saveErrors(), if there are errors in the collection. The Action makes the
determination on whether errors exist and need to be passed to a JSP or
another action. The next action that is invoked may or may not care about
these errors, and calls removeXXX(). That is a bit of a pain I would agree
to have to explicitly make a call to removeErrors() you don't care about.

Let me clarify this a bit more. I think when the application is being
designed, the appdev knows which actions could forward to a particular
action, as well as general application flow. The appdev decides that no
matter who its caller or forwarding entity was, that it's going to disregard
any messages/errors.

The appdev also knows that some actions can only be forwarded to by a small
set or single action, in which case and wants to carry those messages
forward until some future time. In the cases of actions that can be
forwarded to by many other entities, but only wants to remove
messages/errors for some of those would be a bit problematic.  But I think
distinct actions which implement a use-case know when they do or do not care
about errors that happened in a previous action, thus the application
dictates when to remove messages/errors.

Mike Jasnowski

-Original Message-
From: Mike Jasnowski [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 03, 2003 5:45 PM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: RE: ExceptionHandler storing ActionErrors in session


How would your Action know to call that?  How would your app know which
Action was executed after the one that generated the messages?

I would expect the same way an Action determines that it needs to call
saveErrors(), if there are errors in the collection. The Action makes the
determination on whether errors exist and need to be passed to a JSP or
another action. The next action that is invoked may or may not care about
these errors, and calls removeXXX(). That is a bit of a pain I would agree
to have to explicitly make a call to removeErrors() you don't care about.

But how does the tag know whether it should clear them out after one use?
At least with the action the user then has more precise control over when
the messages are cleared.

That said, there may not be many, if any, cases of having to carry messages
past one use. But for example in an application where you have recorded some
errors/messages, but allow the user to continue on. And the messages are
shown persistently at the top of a page or in some other frame, Once the
user decides to clear the errors/messages, an Action would then call the
removeXXX() method.

Mike Jasnowski

-Original Message-
From: David Graham [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 03, 2003 5:34 PM
To: Struts Users Mailing List
Subject: RE: ExceptionHandler storing ActionErrors in session


--- Mike Jasnowski [EMAIL PROTECTED] wrote:
 What about adding a symmetrical removeErrors()/removeMessages() to
 Action?

How would your Action know to call that?  How would your app know which
Action was executed after the one that generated the messages?

David


 -Original Message-
 From: David Graham [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, September 03, 2003 5:21 PM
 To: Struts Users Mailing List
 Subject: Re: ExceptionHandler storing ActionErrors in session


 I don't believe there is currently a way to remove messages from the
 session.  How would Struts know when to remove them?  I have written a
 small subclass of ActionMessages that only returns its messages once.
 This allows me to store messages in the session without them being
 displayed multiple times.

 You're not the first person to need this feature so maybe it's time to
 float the subclass idea on struts-dev (unless there is a better way).

 David


 --- Robert Taylor [EMAIL PROTECTED] wrote:
  I'm just starting to fiddle around with ExceptionHandlers and was
  wondering
  how and when ActionErrors are removed from session scoped if
 configured
  to
  be stored there.
 
  I took a look at the ErrorsTag and the MessagesTag (because I'm
 assuming
  these tags would be used to render the ActionErrors) and didn't see
  provisions for removing ActionErrors from session scope.
 
  I must have missed something obvious here and would appreciate anyone
  who
  could point me in the right direction.
 
  robert
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 


 __
 Do you Yahoo!?
 Yahoo! SiteBuilder - Free, easy-to-use web site design software
 http://sitebuilder.yahoo.com

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



 -
 To unsubscribe

RE: ExceptionHandler storing ActionErrors in session

2003-09-03 Thread David Graham
--- Mike Jasnowski [EMAIL PROTECTED] wrote:
 How would your Action know to call that?  How would your app know which
 Action was executed after the one that generated the messages?
 
 I would expect the same way an Action determines that it needs to call
 saveErrors(), if there are errors in the collection. The Action makes
 the
 determination on whether errors exist and need to be passed to a JSP or
 another action. The next action that is invoked may or may not care
 about
 these errors, and calls removeXXX(). That is a bit of a pain I would
 agree
 to have to explicitly make a call to removeErrors() you don't care
 about.

I think it's a larger pain than you think.  Every Action would have to
call removeMessages().  Even worse, what about forwards that don't use a
custom action such as:

action path=/something forward=/something.jsp/  ?

 
 But how does the tag know whether it should clear them out after one
 use?
 At least with the action the user then has more precise control over
 when
 the messages are cleared.

I think you missed an important distinction in my solution.  The tags
don't change at all.  A special subclass of ActionMessages is stored in
the session that only returns its messages one time.  Any subsequent call
to that object returns no messages so none are displayed.  The actual
object stays around in the session until it is overwritten with new
messages or the session expires.

David

 
 That said, there may not be many, if any, cases of having to carry
 messages
 past one use. But for example in an application where you have recorded
 some
 errors/messages, but allow the user to continue on. And the messages are
 shown persistently at the top of a page or in some other frame, Once the
 user decides to clear the errors/messages, an Action would then call
 the
 removeXXX() method.
 
 Mike Jasnowski
 
 -Original Message-
 From: David Graham [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, September 03, 2003 5:34 PM
 To: Struts Users Mailing List
 Subject: RE: ExceptionHandler storing ActionErrors in session
 
 
 --- Mike Jasnowski [EMAIL PROTECTED] wrote:
  What about adding a symmetrical removeErrors()/removeMessages() to
  Action?
 
 How would your Action know to call that?  How would your app know which
 Action was executed after the one that generated the messages?
 
 David
 
 
  -Original Message-
  From: David Graham [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, September 03, 2003 5:21 PM
  To: Struts Users Mailing List
  Subject: Re: ExceptionHandler storing ActionErrors in session
 
 
  I don't believe there is currently a way to remove messages from the
  session.  How would Struts know when to remove them?  I have written a
  small subclass of ActionMessages that only returns its messages once.
  This allows me to store messages in the session without them being
  displayed multiple times.
 
  You're not the first person to need this feature so maybe it's time to
  float the subclass idea on struts-dev (unless there is a better way).
 
  David
 
 
  --- Robert Taylor [EMAIL PROTECTED] wrote:
   I'm just starting to fiddle around with ExceptionHandlers and was
   wondering
   how and when ActionErrors are removed from session scoped if
  configured
   to
   be stored there.
  
   I took a look at the ErrorsTag and the MessagesTag (because I'm
  assuming
   these tags would be used to render the ActionErrors) and didn't see
   provisions for removing ActionErrors from session scope.
  
   I must have missed something obvious here and would appreciate
 anyone
   who
   could point me in the right direction.
  
   robert
  
  
  
 -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
 
 
  __
  Do you Yahoo!?
  Yahoo! SiteBuilder - Free, easy-to-use web site design software
  http://sitebuilder.yahoo.com
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 __
 Do you Yahoo!?
 Yahoo! SiteBuilder - Free, easy-to-use web site design software
 http://sitebuilder.yahoo.com
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

accessing ApplcationResources from an ExceptionHandler

2003-08-22 Thread Adolfo Miguelez
hi,

having a key of the ApplicationResources.properties in an ExceptionHandler 
subclass, how could I get its corresponding value in the 
ApplicationResources from there? Thanks in advance.

_
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail

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


getting Resources from ExceptionHandler

2003-05-30 Thread Adolfo Miguelez
Hi All,

Does anyone figures out how to get MessageResources from the execute() 
method of an ExceptionHandler?

TIA,

Adolfo.

_
MSN 8 with e-mail virus protection service: 2 months FREE* 
http://join.msn.com/?page=features/virus

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


ExceptionHandler

2003-03-04 Thread Ray Madigan
I moved my ExceptionHandler from a global-exception to an exception
in the action section.  I no longer get the exception detail in the
Globals.EXCEPTION_KEY location.  Am I doing something wrong and it should
be there, or has it moved, or do i need to define a Handler and override
where the exception is put?

Thanks
Ray Madigan

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



RE: ExceptionHandler

2003-03-04 Thread Ray Madigan

How does one get a simple question answered?

I am stuck, the source is not helping, I have searched
the list, and this list won't tell me even if im on track?


-Original Message-
From: Ray Madigan [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 04, 2003 8:55 AM
To: Struts Users Mailing List
Subject: ExceptionHandler


I moved my ExceptionHandler from a global-exception to an exception
in the action section.  I no longer get the exception detail in the
Globals.EXCEPTION_KEY location.  Am I doing something wrong and it should
be there, or has it moved, or do i need to define a Handler and override
where the exception is put?

Thanks
Ray Madigan

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


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



RE: ExceptionHandler

2003-03-04 Thread Dave Newton
On Tue, 2003-03-04 at 17:18, Ray Madigan wrote:
 How does one get a simple question answered?
 
 I am stuck, the source is not helping, I have searched
 the list, and this list won't tell me even if im on track?

about:

 From: Ray Madigan [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, March 04, 2003 8:55 AM

One has patience and waits longer than a single workday realizing that
some of the people on This List actually have jobs and don't get to The
List until after their normal workday.

One recognizes that This List may not HAVE the answer to your question
thereby taking it upon his/herself to CREATE the answer to the question
thus expanding the collective knowledge of This List or waits until
somebody ELSE takes it upon him/herself to do the same.

One knows that nobody here is EXPECTED to answer any questions and that
if one RECEIVES an answer that one should be GRATEFUL that somebody who,
despite their undoubtedly busy schedule, was willing and able to
contribute to The List, and one hopes that they, too, will one day be
able to humbly serve another List Member.

One, hopefully, does NOT get pissy that their question wasn't answered
within THEIR timeframe.

Thus endeth the sermon for the day.

(Hey, do I qualify for net police points now? :)

Dave



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



Re: ExceptionHandler

2003-03-04 Thread alexj
rhooo you need a beer :))

--
Alexandre Jaquet

- Original Message - 
From: Dave Newton [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Tuesday, March 04, 2003 11:34 PM
Subject: RE: ExceptionHandler


 On Tue, 2003-03-04 at 17:18, Ray Madigan wrote:
  How does one get a simple question answered?
  
  I am stuck, the source is not helping, I have searched
  the list, and this list won't tell me even if im on track?
 
 about:
 
  From: Ray Madigan [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, March 04, 2003 8:55 AM
 
 One has patience and waits longer than a single workday realizing that
 some of the people on This List actually have jobs and don't get to The
 List until after their normal workday.
 
 One recognizes that This List may not HAVE the answer to your question
 thereby taking it upon his/herself to CREATE the answer to the question
 thus expanding the collective knowledge of This List or waits until
 somebody ELSE takes it upon him/herself to do the same.
 
 One knows that nobody here is EXPECTED to answer any questions and that
 if one RECEIVES an answer that one should be GRATEFUL that somebody who,
 despite their undoubtedly busy schedule, was willing and able to
 contribute to The List, and one hopes that they, too, will one day be
 able to humbly serve another List Member.
 
 One, hopefully, does NOT get pissy that their question wasn't answered
 within THEIR timeframe.
 
 Thus endeth the sermon for the day.
 
 (Hey, do I qualify for net police points now? :)
 
 Dave
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


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



[OT] Beer! Re: ExceptionHandler

2003-03-04 Thread Dave Newton
On Tue, 2003-03-04 at 17:38, alexj wrote:
 rhooo you need a beer :))

That's a pretty good idea :D

I've had to program with too many new acronyms and studly one-word
open-source projects this week and my brain hurts.

Dave



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



RE: ExceptionHandler

2003-03-04 Thread Wendy Smoak

I'm sorry you're stuck, but speaking only for myself, your question was too
vague for me to even try to solve.  If you show the complete before and
after versions of the tags you're talking about, and maybe a bit of Java/JSP
code that demonstrates the problem, I might paste it into my own project and
modify it a bit to see if I can cause the same behavior you're seeing.  I
learn quite a lot from example code that I read here.

I don't have any idea what's wrong, but if you provide more information,
you'll make it easier for those who are inclined to try to help.

-- 
Wendy Smoak
Applications Systems Analyst, Sr.
Arizona State University PA Information Resources Management


RE: ExceptionHandler

2003-03-04 Thread Becky Norum
Well said, Wendy.  I often do the same - I've learned much more from
some of the questions on various forums than from books or tutorials.

Becky

On Tue, 2003-03-04 at 17:52, Wendy Smoak wrote:
 I'm sorry you're stuck, but speaking only for myself, your question was too
 vague for me to even try to solve.  If you show the complete before and
 after versions of the tags you're talking about, and maybe a bit of Java/JSP
 code that demonstrates the problem, I might paste it into my own project and
 modify it a bit to see if I can cause the same behavior you're seeing.  I
 learn quite a lot from example code that I read here.
 
 I don't have any idea what's wrong, but if you provide more information,
 you'll make it easier for those who are inclined to try to help.


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



RE: ExceptionHandler

2003-03-04 Thread Ray Madigan
Wendy, thanks for your concern.

I appreciate your willingness to help.  The question I have is:

Is the location that a jsp finds the exception the same between
a global exception and an exception that is associated with an
action.  If the location is the same - something else is wrong
and I will dig it out, hopefully.  If it is different, it will
make getting the handler to work easier.

The jsp page worked when it was forwarded from a global-exception.

Unfortunatly - I have been using struts for three weeks and have
plowed my way through most of my issues, with help from this list.
It seems like the one area where there is a lack of support material
is in the area of exception handling.

I will forgo the whine about why my project is so important - :-)

Again, thanks
Ray Madigan

-Original Message-
From: Wendy Smoak [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 04, 2003 2:52 PM
To: 'Struts Users Mailing List'
Subject: RE: ExceptionHandler



I'm sorry you're stuck, but speaking only for myself, your question was too
vague for me to even try to solve.  If you show the complete before and
after versions of the tags you're talking about, and maybe a bit of Java/JSP
code that demonstrates the problem, I might paste it into my own project and
modify it a bit to see if I can cause the same behavior you're seeing.  I
learn quite a lot from example code that I read here.

I don't have any idea what's wrong, but if you provide more information,
you'll make it easier for those who are inclined to try to help.

--
Wendy Smoak
Applications Systems Analyst, Sr.
Arizona State University PA Information Resources Management


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



ExceptionHandler DispatchAction (1.1b1 vs b2)

2002-10-28 Thread Andrew Hill
Been trying to get my first struts ExceptionHandler to work today and just
came across another good reason to make the jump from 1.1b1 to 1.1b2.

Seems that exceptions thrown in a DispatchAction are handled correctly in
1.1b2 (ie: if possible thrown up where you can process them with an
exception handler) while 1.1b1 always writes an error response out
immediately using response.sendError() , thus preventing the exception
bubbling up to where the RequestProcessor can pass it to your
ExceptionHandler like it does for an Action.

Many cheers to the struts devs for fixing this! :-)

1.1b1 Code:
---
snip
} catch (InvocationTargetException e)
{
String message =
messages.getMessage(dispatch.error, mapping.getPath(),
name);
log.error(message, e);
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
   message);
return (null);
}
/snip

1.1b2 Code:
---
snip
} catch (InvocationTargetException e) {
// Rethrow the target exception if possible so that the
// exception handling machinery can deal with it
Throwable t = e.getTargetException();
if (t instanceof Exception) {
throw ((Exception) t);
} else {
String message =
messages.getMessage(dispatch.error, mapping.getPath(),
name);
log.error(message, e);
response.sendError
(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message);
return (null);
}
/snip







btw
whinge subject=coding.style
I really can't stand this sun style java indenting thats used in the struts
source. Its so random and unreadable and ugly. Trying to scan more than a
few lines of it really gives me a headache. Id rather debug BF code (well ok
I wouldnt but at least BF doesnt pretend to be readable...)
When Im dictator for life everyone will have to use C style indenting and
put their curlies back where they belong...sigh/
/whinge
/btw


--
To unsubscribe, e-mail:   mailto:struts-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org




How do I use a Customised Struts ExceptionHandler ??

2002-10-10 Thread Gudla, Shailender X -ND

I have a class that extents the default struts ExceptionHandler ( see below).

Now, when an exception occurs in the 'Action' class..., how do i make 
sure that
the 'execute()' in 'MyExceptionHandler' is executed instaed of the 
default ExceptionHandler?


public class MyExceptionHandler extends ExceptionHandler {

private MyChainedException tCE = null;=

/**
 * Constructor for an external message 
 * @param tce of type MyChainedException
 *
 */
public MyExceptionHandler(MyChainedException tce) {
this.tCE = tce; 

}
public ActionForward execute(Exception ex,
ExceptionConfig config,
ActionMapping mapping,
ActionForm formInstance,
HttpServletRequest request,
HttpServletResponse response)
 throws ServletException {
  ActionForward forward = null;
  ActionError error = null;
  String property = null;

  /* Get the path for the forward either from the exception element
   * or from the input attribute.
   */
  String path = null;
  if (config.getPath() != null) {
   path = config.getPath();
  }else{
path = mapping.getInput();
  }
  // Construct the forward object
  forward = new ActionForward(path);

  /* Figure out what type of exception has been thrown. The Struts
   * AppException is not being used in this example.
   */
  if( tCE instanceof MyChainedException) {
// This is the specialized behavior
   
Throwable t = tCE.getCause();
String messageKey = t.getClass().getName();
error = new ActionError( messageKey );
   
  }

  // Store the ActionError into the proper scope
  // The storeException method is defined in the parent class
  storeException(request, property, error, forward, =
config.getScope());

  return forward;
}


}


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




Re: How do I use a Customised Struts ExceptionHandler ??

2002-10-10 Thread chuckcavaness

In the struts-config.xml file, add an exception 
element to this action. You can also put it in the 
global-exceptions section if more than one action will 
utilize this exception handler. 

Here's an example action mapping using an exception 
element:

 action
   path=/signin
   type=com.cavaness.beer4all.security.LoginAction
   scope=request
   name=loginForm
   validate=true
   input=/signin.jsp
   exception 
 handler=com.foo.MyExceptionHandler
 key=error.invalidlogin
 path=/signin.jsp
 scope=request
type=com.cavaness.beer4all.common.exceptions.InvalidLogi
nException/ 
   forward name=Success path=/index.jsp 
redirect=true/
   forward name=Failure path=/signin.jsp/
 /action 

Notice the exception element. The handler attribute is 
the fully-qualified class name of your handler. As you 
have done, it must extend the default handler. The type 
attribute specifes the fully-qualified exception class 
for when you want to call this exception handler. You 
can put java.lang.Exception if you want this handler 
to process all exceptions thrown during this Action.

Hope that helps,
Chuck
 I have a class that extents the default struts ExceptionHandler ( see below).
 
 Now, when an exception occurs in the 'Action' class..., how do i make 
 sure that
 the 'execute()' in 'MyExceptionHandler' is executed instaed of the 
 default ExceptionHandler?
 
 
 public class MyExceptionHandler extends ExceptionHandler {
 
   private MyChainedException tCE = null;=
 
   /**
* Constructor for an external message 
* @param tce of type MyChainedException
*
*/
   public MyExceptionHandler(MyChainedException tce) {
   this.tCE = tce; 
   
   }
   public ActionForward execute(Exception ex,
   ExceptionConfig config,
   ActionMapping mapping,
   ActionForm formInstance,
   HttpServletRequest request,
   HttpServletResponse response)
  throws ServletException {
   ActionForward forward = null;
   ActionError error = null;
   String property = null;
 
   /* Get the path for the forward either from the exception element
* or from the input attribute.
*/
   String path = null;
   if (config.getPath() != null) {
path = config.getPath();
   }else{
 path = mapping.getInput();
   }
   // Construct the forward object
   forward = new ActionForward(path);
 
   /* Figure out what type of exception has been thrown. The Struts
* AppException is not being used in this example.
*/
   if( tCE instanceof MyChainedException) {
 // This is the specialized behavior

 Throwable t = tCE.getCause();
 String messageKey = t.getClass().getName();
 error = new ActionError( messageKey );

   }
 
   // Store the ActionError into the proper scope
   // The storeException method is defined in the parent class
   storeException(request, property, error, forward, =
 config.getScope());
 
   return forward;
 }
 
 
 }
 
 
 --
 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]




[ExceptionHandler] NoClassDefFoundError: org/apache/struts/action/ExceptionHandler

2002-08-30 Thread Charles

Hi,
I'm using declarative exception handling in struts 1.1. I have no problems
implementing them. However I want to display additional information of the
exception by getting the e.getMessage() and including it into the
ActionError object. I've read up Chuck 's chapter 10 on exception and used
SpecialExceptionHandler.java as reference in building my own
exceptionhandler class.

I've included the class in the struts-config.xml like this:

global-exceptions
exception key=error.system type=javax.ejb.FinderException
path=/error.jsp
handler=com.example.struts.exception.SpecialExceptionHandler/
/global-exceptions

However when my application throws the javax.ejb.FinderException, instead of
running the SpecialExceptionHandler I get a NoClassDefFoundError for
org.apache.struts.action.ExceptionHandler.

Adding the struts.jar into the classpath would solve this problem but that
shouldn't be the way. Any ideas?

TIA,
Charles

p/s I'm using Weblogic 7.0 and ServletExec 4.1



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




Re: [ExceptionHandler] NoClassDefFoundError: org/apache/struts/action/ExceptionHandler

2002-08-30 Thread Charles

Btw..here's an except of the error message i get :

- start of exception -
Error. The server encountered an unexpected condition which prevented it
from fulfilling the request.


java.lang.NoClassDefFoundError: org/apache/struts/action/ExceptionHandler
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:509)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:246)
at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
at java.lang.ClassLoader.findSystemClass(ClassLoader.java:673)
at
com.newatlanta.servletexec.ApplClassLoader.loadClass(ApplClassLoader.java:40
1)
at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
at
org.apache.struts.util.RequestUtils.applicationClass(RequestUtils.java:193)
at
org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:21
9)
at
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.
java:496)
at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProces
sor.java:431)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:266)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1227)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:502)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
com.newatlanta.servletexec.ServletExec.CallServletService(ServletExec.java:1
650)
at
com.newatlanta.servletexec.SERequestDispatcher.forwardServlet(SERequestDispa
tcher.java:274)
at
com.newatlanta.servletexec.SERequestDispatcher.forward(SERequestDispatcher.j
ava:191)
at
com.newatlanta.servletexec.ApplicationInfo.processApplRequest(ApplicationInf
o.java:1173)
at
com.newatlanta.servletexec.ServerHostInfo.processApplRequest(ServerHostInfo.
java:941)
at
com.newatlanta.servletexec.ServletExec.ProcessRequest(ServletExec.java:1206)
at
com.newatlanta.servletexec.ServletExec.ProcessRequest(ServletExec.java:1056)
at
com.newatlanta.servletexec.ServletExecService.processServletRequest(ServletE
xecService.java:165)
at
com.newatlanta.servletexec.ServletExecService.Run(ServletExecService.java:19
7)
at
com.newatlanta.servletexec.HttpServerRequest.run(HttpServerRequest.java:106)
-- end of exception
message -
and here's how my SpecialExceptionHandler looks like:


-- start of
SpecialExceptionHandler.java --
package com.example.struts.exception;


import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ExceptionHandler;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionError;
import org.apache.struts.util.AppException;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.config.ExceptionConfig;


public class SpecialExceptionHandler extends ExceptionHandler {

  public ActionForward execute(Exception ex,
  ExceptionConfig config,
  ActionMapping mapping,
  ActionForm formInstance,
  HttpServletRequest request,
  HttpServletResponse response)
throws ServletException {
  ActionForward forward = null;
  ActionError error = null;
  String property = null;

  String path = null;
  if (config.getPath() != null) {
   path = config.getPath();
  }else{
path = mapping.getInput();
  }
  forward = new ActionForward(path);

error = new ActionError(config.getKey(),ex);
property = error.getKey();
storeException(request, property, error, forward, config.getScope());

  return forward;
}
}

- end of
SpecialExceptionHandler -

- Original Message -
From: Charles [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Friday, August 30, 2002 3:49 PM
Subject: [ExceptionHandler