Error Handling

2003-12-22 Thread Travis D. Falls
I have a question regarding error handling.  There are
many camps that advocate different error handling
methodologies.  What is the best way to do it when
designing an application?

t

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



Error Handling without using errorPage directive

2003-11-05 Thread Jonathan Gordon
Hello all,

I'd like to handle any and all exceptions handled thrown by my JSP pages 
declaratively, ideally using global-exceptions in struts-config. 
Currently, I have a JSP page called by a tile that uses the JSTL Tag 
Library.  Using the c tag I perform a check like this:

c:if test=${!empty featuredProductView.title}
... do some work ...
/c:if
If the method getTitle() throws an exception, I currently see the 
following on the screen:

-- snip --
javax.servlet.ServletException: javax.servlet.jsp.JspException: An error 
occurred while evaluating custom action attribute test with value 
${!empty featuredProductView.title}: An error occurred while getting 
property title from an instance of class 
com.mandaladesigns.apps.commerce.framework.view.FeaturedProductView 
(com.mandaladesigns.common.exceptions.MandalaException)
-- snip --

This also appears in the tomcat localhost log along with the stack 
trace.  But what's really interesting to me is the data I placed in 
com.mandaladesigns.common.exceptions.MandalaException, which is my own 
exception type that subclasses RuntimeException.  Though explicitly 
using an errorPage directive in the page works, I'd like to avoid having 
to place an errorPage directive in all of my JSP files.

So, is there a way that I can place a directive, either in web.xml or 
struts-config.xml that will handle these exceptions?  It seems that 
using error-page in web.xml and global-exception in 
struts-config.xml directives are not consulted for this situation.  I've 
created entries for every type of exception that seems relevant in both 
places but they don't seem to be getting called.

Thanks for your help,

Jonathan.

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


RE: Struts Error Handling Problem

2003-07-30 Thread Yansheng Lin

What do you mean if there is a reason for this?  In the case of an error, you
can output error msg through html:error/

In your case, you might want to try return back to your input instead of
forwarding it to the .jsp page.  I know they are almost the same, but they is a
mirror difference.  So here comes the harder part.  If you believe that this is
what's supposed to happen, then you found a bug.  You can submit your bug
through bugzilla.apache.org.

Hope this helps!


-Original Message-
From: Rodney Paul [mailto:[EMAIL PROTECTED] 
Sent: July 29, 2003 11:28 PM
To: Struts Users Mailing List (E-mail)
Subject: Struts Error Handling Problem


Hi All,

I am currently using the Struts framework to develop a wizard application.
When using the Struts framework I notice that form data does not get
re-displayed after
issuing ActionErrors. Is there any reason for this?

I use the following code structure for developing the wizard:

OrganisationNameSearch.jsp
OrganisationNameSearchActionForm.java
OrganistaionNameSearchAction.java

and here are the important configuration settings I use to execute code:

---OrganisationNameSearch.jsp---
html:form  action=/company/OrganisationNameSearch
name=company.OrganisationNameSearch
 
type=net.natdata.application.itf.insolvency.company.OrganisationNameSearchActio
nForm


---Struts Configuration---
struts-config
form-beans
form-bean name=company.OrganisationNameSearchActionForm
 
type=net.natdata.application.itf.insolvency.company.OrganisationNameSearchActio
nForm /
/form-beans
action-mappings
action path=/company/OrganisationNameSearch
 
type=net.natdata.application.itf.insolvency.company.OrganisationNameSearchActio
n
name=company.OrganisationNameSearchActionForm
validate=true
scope=request
input=/company/OrganisationNameSearch.jsp
parameter=method
forward name=nextpath=/company/OrganisationBrowse.jsp
redirect=false /
forward name=failure
path=/company/OrganisationNameSearch.jsp redirect=false /
/action
/action-mappings
struts-config


Can someone please give me an indication as to why this is happening?

Cheers
Rodney

-
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: Struts Error Handling Problem

2003-07-30 Thread Yansheng Lin
I didn't finish the first paragraph!!  Sorry.  See [[append]]

---
What do you mean if there is a reason for this?  In the case of an error, you
can output error msg through html:error/ [[append]] and all the data entered
will be retained if you return to the original jsp page.
---

Outlook is horrible for editing! But anyways, I guess what I wanted to emphasis
was that you can display errors along with all the form data retained.


-Original Message-
From: Yansheng Lin [mailto:[EMAIL PROTECTED] 
Sent: July 30, 2003 3:10 PM
To: 'Struts Users Mailing List'
Subject: RE: Struts Error Handling Problem

What do you mean if there is a reason for this?  In the case of an error, you
can output error msg through html:error/

In your case, you might want to try return back to your input instead of
forwarding it to the .jsp page.  I know they are almost the same, but they is a
mirror difference.  So here comes the harder part.  If you believe that this is
what's supposed to happen, then you found a bug.  You can submit your bug
through bugzilla.apache.org.

Hope this helps!


-Original Message-
From: Rodney Paul [mailto:[EMAIL PROTECTED] 
Sent: July 29, 2003 11:28 PM
To: Struts Users Mailing List (E-mail)
Subject: Struts Error Handling Problem


Hi All,

I am currently using the Struts framework to develop a wizard application.
When using the Struts framework I notice that form data does not get
re-displayed after
issuing ActionErrors. Is there any reason for this?

I use the following code structure for developing the wizard:

OrganisationNameSearch.jsp
OrganisationNameSearchActionForm.java
OrganistaionNameSearchAction.java

and here are the important configuration settings I use to execute code:

---OrganisationNameSearch.jsp---
html:form  action=/company/OrganisationNameSearch
name=company.OrganisationNameSearch
 
type=net.natdata.application.itf.insolvency.company.OrganisationNameSearchActio
nForm


---Struts Configuration---
struts-config
form-beans
form-bean name=company.OrganisationNameSearchActionForm
 
type=net.natdata.application.itf.insolvency.company.OrganisationNameSearchActio
nForm /
/form-beans
action-mappings
action path=/company/OrganisationNameSearch
 
type=net.natdata.application.itf.insolvency.company.OrganisationNameSearchActio
n
name=company.OrganisationNameSearchActionForm
validate=true
scope=request
input=/company/OrganisationNameSearch.jsp
parameter=method
forward name=nextpath=/company/OrganisationBrowse.jsp
redirect=false /
forward name=failure
path=/company/OrganisationNameSearch.jsp redirect=false /
/action
/action-mappings
struts-config


Can someone please give me an indication as to why this is happening?

Cheers
Rodney

-
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]



Struts Error Handling Problem

2003-07-29 Thread Rodney Paul
Hi All,

I am currently using the Struts framework to develop a wizard application.
When using the Struts framework I notice that form data does not get re-displayed after
issuing ActionErrors. Is there any reason for this?

I use the following code structure for developing the wizard:

OrganisationNameSearch.jsp
OrganisationNameSearchActionForm.java
OrganistaionNameSearchAction.java

and here are the important configuration settings I use to execute code:

---OrganisationNameSearch.jsp---
html:form  action=/company/OrganisationNameSearch
name=company.OrganisationNameSearch

type=net.natdata.application.itf.insolvency.company.OrganisationNameSearchActionForm


---Struts Configuration---
struts-config
form-beans
form-bean name=company.OrganisationNameSearchActionForm
   
type=net.natdata.application.itf.insolvency.company.OrganisationNameSearchActionForm 
/
/form-beans
action-mappings
action path=/company/OrganisationNameSearch

type=net.natdata.application.itf.insolvency.company.OrganisationNameSearchAction
name=company.OrganisationNameSearchActionForm
validate=true
scope=request
input=/company/OrganisationNameSearch.jsp
parameter=method
forward name=nextpath=/company/OrganisationBrowse.jsp 
redirect=false /
forward name=failure path=/company/OrganisationNameSearch.jsp 
redirect=false /
/action
/action-mappings
struts-config


Can someone please give me an indication as to why this is happening?

Cheers
Rodney

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



Struts Error Handling Problem

2003-07-07 Thread Rodney Paul
I am currently experiencing a problem with the Struts error handling framework. 
I am trying to use the error handling framework from ActionForm and 
LookupDispatchAction classes. 

The problem I have is in regards to display of error messages. I have found 
that error messages are being displayed correctly using the html:errors/ tag 
from a ActionForm validate method, but are not being displayed using the 
LookupDispatchAction methods. Please see below: 

ActionForm 
public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest 
httpServletRequest) { 
ActionErrors errors = new ActionErrors(); 
errors.add(field, new ActionError(messageKey)); 
return errors; 
} 

LookupDispatchAction 
public ActionForward next(ActionMapping mapping, ActionForm form, 
HttpServletRequest request, HttpServletResponse response) { 
... 
ActionErrors errors = new ActionErrors(); 
errors.add(field, new ActionError(messageKey)); 
if(!errors.isEmpty()) { 
saveErrors(request, errors); 
} 
return (ActionForward)mapping.findForward(target); 
} 


Could someone please tell me why this is so. I would be most interested if 
anyone could provide a solution for this. 

NOTE: 
I am using the Struts version 1.1 release with tomcat version 4.1.24 


Yours Sincerely 
Rodney Paul 

ps. You can contact me via email at [EMAIL PROTECTED]

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



error handling

2003-06-27 Thread Pramod . P
   
  
 Hi,   
  
Can anyone send me a solution for the following problem:   
  
 From two jsps, I am coming to the same action class. (in the first jsp, I have a 
link, clicking on  
 this will go to an action say MyAction. From the second jsp also, I can goto the same 
action
 MyAction). In the MyAction class, how do I write code to return to the parent page 
when error   
 occurs. (I am catching error using ActionErrors)  
  
 action   
  
   path  = /MyAction 
  
   type = mypackage.MyAction 
  
   name = myFormBean 
  
   scope = session  
  
   forward name=success path=/pages/Result.jsp / 
  
 /action 
  
   
  
   
  
   
  
 Here, if the forward is success, i am able to got Result.jsp. But if any error is 
there, how do I   
 display the error in the parent page? (I can come to this action from two different 
parent page)
 Please advise.
  
   
  
   
  
 Thanks,   
  
   
  
   
  
 Pramod
  
   
  
   
  
   
  
   
  







This  electronic  mail  message  is  intended  solely  for  the  named  recipients  
and  may contain
confidential  and  proprietary  business information of eFunds Corporation and all its 
subsidiaries.
If  you  are  not a named recipient, please notify the sender immediately.  You may 
not disclose the
contents  to  any  other  person;  use  this  electronic  mail message or its contents 
for any other
purpose; or further store or copy its contents in any medium



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



Re: error handling

2003-06-27 Thread Prashanth.S
Hi pramod,
you once thoroughly take a look at actionerror and actionerrors docs.
If u want to route ur errors to the parent page,
give the following statement in your action class.
 
actionErrors.add(ActionErrors.GLOBAL_ERROR, new ActionError(errors.tx.incomplete));
saveErrors(request, actionErrors);
return (mapping.findForward(failure));
 
Than in struts-config.xml,Add the following line.
 
forward name=failure path=/vascdt/StaticUpLoad.jsp /
  /action 
 
 
Than in your jsp type down the following
html:errors /
 
The above thing works for ActionErrors.GLOBAL_ERROR.If u want to handle individual 
errors u have to do minor modifications which any good struts tutorial can 
explain.Thats very simple.

 
Hope this helps.
Cheers
Prashanth
 
 


[EMAIL PROTECTED] wrote:

Hi, 
Can anyone send me a solution for the following problem: 
From two jsps, I am coming to the same action class. (in the first jsp, I have a 
link, clicking on 
this will go to an action say MyAction. From the second jsp also, I can goto the same 
action 
MyAction). In the MyAction class, how do I write code to return to the parent page 
when error 
occurs. (I am catching error using ActionErrors) 
path = /MyAction 
type = mypackage.MyAction 
name = myFormBean 
scope = session 





Here, if the forward is success, i am able to got Result.jsp. But if any error is 
there, how do I 
display the error in the parent page? (I can come to this action from two different 
parent page) 
Please advise. 


Thanks, 


Pramod 











This electronic mail message is intended solely for the named recipients and may 
contain
confidential and proprietary business information of eFunds Corporation and all its 
subsidiaries.
If you are not a named recipient, please notify the sender immediately. You may not 
disclose the
contents to any other person; use this electronic mail message or its contents for any 
other
purpose; or further store or copy its contents in any medium



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



-
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!

Re: error handling

2003-06-27 Thread Pramod . P

But by doing in this way, for the forward name=failure I will always end up in 
StatuicUpload.jsp
(for the below example) I don't want to goto that jsp. I need to goto the parent page.
Let me explain the scenario once again. From two different jsps (say a.jsp and b.jsp) 
I am coming to
an action (bt clicking the link in each jsp). From this action, upon an error I want 
to go back to
a.jsp (if the request came from a.jsp)  or to b.jsp (if the request came from 
b.jsp). So here I
won't be able to  hard code the path either as a.jsp or as b.jsp in the 
struts-config.xml. In
you example upon error, it will always forward to StaticUpload.jsp

Thanks,
Pramod



   

Prashanth.S  

[EMAIL PROTECTED]   To: Struts Users Mailing List [EMAIL 
PROTECTED]
ahoo.comcc:   

 Subject: Re: error handling   

06/27/2003 

03:14 PM   

Please respond 

to Struts 

Users Mailing  

List  

   

   





Hi pramod,
you once thoroughly take a look at actionerror and actionerrors docs.
If u want to route ur errors to the parent page,
give the following statement in your action class.

actionErrors.add(ActionErrors.GLOBAL_ERROR, new ActionError(errors.tx.incomplete));
   saveErrors(request, actionErrors);
   return (mapping.findForward(failure));

Than in struts-config.xml,Add the following line.

forward name=failure path=/vascdt/StaticUpLoad.jsp /
/action


Than in your jsp type down the following
html:errors /

The above thing works for ActionErrors.GLOBAL_ERROR.If u want to handle individual 
errors u have to
do minor modifications which any good struts tutorial can explain.Thats very simple.


Hope this helps.
Cheers
Prashanth




[EMAIL PROTECTED] wrote:

Hi,
Can anyone send me a solution for the following problem:
From two jsps, I am coming to the same action class. (in the first jsp, I have a 
link, clicking on
this will go to an action say MyAction. From the second jsp also, I can goto the same 
action
MyAction). In the MyAction class, how do I write code to return to the parent page 
when error
occurs. (I am catching error using ActionErrors)
path = /MyAction
type = mypackage.MyAction
name = myFormBean
scope = session





Here, if the forward is success, i am able to got Result.jsp. But if any error is 
there, how do I
display the error in the parent page? (I can come to this action from two different 
parent page)
Please advise.


Thanks,


Pramod











This electronic mail message is intended solely for the named recipients and may 
contain
confidential and proprietary business information of eFunds Corporation and all its 
subsidiaries.
If you are not a named recipient, please notify the sender immediately. You may not 
disclose the
contents to any other person; use this electronic mail message or its contents for any 
other
purpose; or further store or copy its contents in any medium



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



-
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!




This  electronic  mail  message  is  intended  solely  for  the  named  recipients  
and  may contain
confidential  and  proprietary  business information of eFunds Corporation and all its 
subsidiaries.
If  you  are  not a named recipient, please notify the sender immediately.  You may 
not disclose the
contents  to  any  other  person;  use  this  electronic  mail message or its contents 
for any other
purpose; or further store or copy its contents in any medium

AW: error handling

2003-06-27 Thread sem . Gottofrey
Hi Pramod,

One solution would be to define two different action mapings as follows:

  action  
path  = /MyActionFromMyFirstJsp
type  = mypackage.MyAction
name  = myFormBean
scope = session
input =/pages/myFirst.jsp
 forward name=success path=/pages/Result.jsp /
  /action

  action  
path  = /MyActionFromMySecondJsp
type  = mypackage.MyAction
name  = myFormBean
scope = session
input =/pages/mySecond.jsp
 forward name=success path=/pages/Result.jsp /
  /action


   In your action you then use 'return mapping.getInputForward()' in case of
error.

HTH
Robert
  
  
 -Ursprüngliche Nachricht-
 Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Gesendet: Freitag, 27. Juni 2003 11:15
 An: Struts Users Mailing List
 Betreff: error handling
   

  Hi,  

 Can anyone send me a solution for the following 
 problem: 
  From two jsps, I am coming to the same action class. (in the 
 first jsp, I have a link, clicking on  
  this will go to an action say MyAction. From the second jsp 
 also, I can goto the same action
  MyAction). In the MyAction class, how do I write code to 
 return to the parent page when error   
  occurs. (I am catching error using ActionErrors) 

  action  
path  = /MyAction
type = mypackage.MyAction
name = myFormBean
scope = session 
forward name=success path=/pages/Result.jsp /
  /action
   

  Here, if the forward is success, i am able to got 
 Result.jsp. But if any error is there, how do I   
  display the error in the parent page? (I can come to this 
 action from two different parent page)
  Please advise.   


  Thanks,  


  Pramod   

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



Re: error handling

2003-06-27 Thread Nicolas De Loof

 But by doing in this way, for the forward name=failure I will always end up in 
 StatuicUpload.jsp
 (for the below example) I don't want to goto that jsp. I need to goto the parent 
 page.
 Let me explain the scenario once again. From two different jsps (say a.jsp and 
 b.jsp) I am coming to
 an action (bt clicking the link in each jsp). From this action, upon an error I want 
 to go back to
 a.jsp (if the request came from a.jsp)  or to b.jsp (if the request came from 
 b.jsp). So here I
 won't be able to  hard code the path either as a.jsp or as b.jsp in the 
 struts-config.xml. In
 you example upon error, it will always forward to StaticUpload.jsp

 Thanks,
 Pramod

If you really cannot set multiples action-mappings in struts-config.xml (that is the 
cleaner way to do), you can add a
parameter to your request for the incoming JSP :

html:hidden name=from value=/a.jsp/

and build a new forward in your action when errors occurs :

if (!errors.isEmpty()) {
saveErrors(request, errors);
String commingFrom = request.getParameter(from);
return new ActionForward(from);
}


Nico.


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



Re: error handling

2003-06-27 Thread Prashanth.S
ya
I agree with nicolas.But is there any way of  doing it typically THE STRUTS WAY???
cheers
Prashanth

Nicolas De Loof [EMAIL PROTECTED] wrote:

 But by doing in this way, for the forward name=failure I will always end up in 
 StatuicUpload.jsp
 (for the below example) I don't want to goto that jsp. I need to goto the parent 
 page.
 Let me explain the scenario once again. From two different jsps (say a.jsp and 
 b.jsp) I am coming to
 an action (bt clicking the link in each jsp). From this action, upon an error I want 
 to go back to
 a.jsp (if the request came from a.jsp) or to b.jsp (if the request came from 
 b.jsp). So here I
 won't be able to hard code the path either as a.jsp or as b.jsp in the 
 struts-config.xml. In
 you example upon error, it will always forward to StaticUpload.jsp

 Thanks,
 Pramod

If you really cannot set multiples action-mappings in struts-config.xml (that is the 
cleaner way to do), you can add a
parameter to your request for the incoming JSP :



and build a new forward in your action when errors occurs :

if (!errors.isEmpty()) {
saveErrors(request, errors);
String commingFrom = request.getParameter(from);
return new ActionForward(from);
}


Nico.


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



-
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!

Re: AW: error handling

2003-06-27 Thread Pramod . P

Thank you Robert.
But, the mapping.getInputForward gives me an output like this:
reached here...failure
actionForward : ForwardConfig[name=null,path=null,redirect=false,contextRelative=false]

But, by giving two mappings in the struts-config, I was able to solve the probelm for 
the time
being. Instead of mapping.getInputForward, I am setting one more forward name? for 
each action
mapping to handle the failure case.

I don't understand why the mapping.getInputForward returns null. Please let me know if 
u have any
clue.

Thanks for the idea!!!
Pramod



   

sem.Gottofrey@ 

bkw-fmb.ch   To: [EMAIL PROTECTED] 
   
 cc:   

06/27/2003   Subject: AW: error handling   

03:36 PM   

Please respond 

to Struts 

Users Mailing  

List  

   

   





Hi Pramod,

One solution would be to define two different action mapings as follows:

  action
   path  = /MyActionFromMyFirstJsp
   type  = mypackage.MyAction
   name  = myFormBean
   scope = session
   input =/pages/myFirst.jsp
forward name=success path=/pages/Result.jsp /
  /action

  action
   path  = /MyActionFromMySecondJsp
   type  = mypackage.MyAction
   name  = myFormBean
   scope = session
   input =/pages/mySecond.jsp
forward name=success path=/pages/Result.jsp /
  /action


   In your action you then use 'return mapping.getInputForward()' in case of
error.

HTH
Robert


 -Ursprüngliche Nachricht-
 Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Gesendet: Freitag, 27. Juni 2003 11:15
 An: Struts Users Mailing List
 Betreff: error handling


  Hi,

 Can anyone send me a solution for the following
 problem:
  From two jsps, I am coming to the same action class. (in the
 first jsp, I have a link, clicking on
  this will go to an action say MyAction. From the second jsp
 also, I can goto the same action
  MyAction). In the MyAction class, how do I write code to
 return to the parent page when error
  occurs. (I am catching error using ActionErrors)

  action
path  = /MyAction
type = mypackage.MyAction
name = myFormBean
scope = session
forward name=success path=/pages/Result.jsp /
  /action


  Here, if the forward is success, i am able to got
 Result.jsp. But if any error is there, how do I
  display the error in the parent page? (I can come to this
 action from two different parent page)
  Please advise.


  Thanks,


  Pramod

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





This  electronic  mail  message  is  intended  solely  for  the  named  recipients  
and  may contain
confidential  and  proprietary  business information of eFunds Corporation and all its 
subsidiaries.
If  you  are  not a named recipient, please notify the sender immediately.  You may 
not disclose the
contents  to  any  other  person;  use  this  electronic  mail message or its contents 
for any other
purpose; or further store or copy its contents in any medium



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



Re: error handling

2003-06-27 Thread Pramod . P

Hi Nico, it is working by giving multiple action mappings.

Thank you very much!!,
Pramod



   
 
Nicolas De
 
Loof To: Struts Users Mailing List [EMAIL 
PROTECTED]  
nicolas.deloof   cc:  
 
@cgey.comSubject: Re: error handling  
 
   
 
06/27/2003 
 
03:44 PM   
 
Please respond 
 
to Struts 
 
Users Mailing  
 
List  
 
   
 
   
 





 But by doing in this way, for the forward name=failure I will always end up in 
 StatuicUpload.jsp
 (for the below example) I don't want to goto that jsp. I need to goto the parent 
 page.
 Let me explain the scenario once again. From two different jsps (say a.jsp and 
 b.jsp) I am coming
to
 an action (bt clicking the link in each jsp). From this action, upon an error I want 
 to go back to
 a.jsp (if the request came from a.jsp)  or to b.jsp (if the request came from 
 b.jsp). So here I
 won't be able to  hard code the path either as a.jsp or as b.jsp in the 
 struts-config.xml. In
 you example upon error, it will always forward to StaticUpload.jsp

 Thanks,
 Pramod

If you really cannot set multiples action-mappings in struts-config.xml (that is the 
cleaner way to
do), you can add a
parameter to your request for the incoming JSP :

   html:hidden name=from value=/a.jsp/

and build a new forward in your action when errors occurs :

   if (!errors.isEmpty()) {
   saveErrors(request, errors);
   String commingFrom = request.getParameter(from);
   return new ActionForward(from);
   }


Nico.


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





This  electronic  mail  message  is  intended  solely  for  the  named  recipients  
and  may contain
confidential  and  proprietary  business information of eFunds Corporation and all its 
subsidiaries.
If  you  are  not a named recipient, please notify the sender immediately.  You may 
not disclose the
contents  to  any  other  person;  use  this  electronic  mail message or its contents 
for any other
purpose; or further store or copy its contents in any medium



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



AW: AW: error handling

2003-06-27 Thread sem . Gottofrey
Hi Pramod,

did you add the 'input' attribute to your mapping?

If yes, I don't know what's wrong with it.
I assume that you are using struts 1.1, are you?

The 'old' way to do it was 'return new ActionForward(mapping.getInput())', I
think.
May be you could try this as well.


Cheers
Robert

 -Ursprüngliche Nachricht-
 Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Gesendet: Freitag, 27. Juni 2003 13:01
 An: Struts Users Mailing List
 Betreff: Re: AW: error handling
 
 
 
 Thank you Robert.
 But, the mapping.getInputForward gives me an output like this:
 reached here...failure
 actionForward : 
 ForwardConfig[name=null,path=null,redirect=false,contextRelati
 ve=false]
 
 But, by giving two mappings in the struts-config, I was able 
 to solve the probelm for the time
 being. Instead of mapping.getInputForward, I am setting one 
 more forward name? for each action
 mapping to handle the failure case.
 
 I don't understand why the mapping.getInputForward returns 
 null. Please let me know if u have any
 clue.
 
 Thanks for the idea!!!
 Pramod
 
 
 
   
  
 sem.Gottofrey@
  
 bkw-fmb.ch   To: 
 [EMAIL PROTECTED]
  cc:  
  
 06/27/2003   Subject: AW: 
 error handling   
 03:36 PM  
  
 Please respond
  
 to Struts
  
 Users Mailing 
  
 List 
  
   
  
   
  
 
 
 
 
 Hi Pramod,
 
 One solution would be to define two different action mapings 
 as follows:
 
   action
path  = /MyActionFromMyFirstJsp
type  = mypackage.MyAction
name  = myFormBean
scope = session
input =/pages/myFirst.jsp
 forward name=success path=/pages/Result.jsp /
   /action
 
   action
path  = /MyActionFromMySecondJsp
type  = mypackage.MyAction
name  = myFormBean
scope = session
input =/pages/mySecond.jsp
 forward name=success path=/pages/Result.jsp /
   /action
 
 
In your action you then use 'return 
 mapping.getInputForward()' in case of
 error.
 
 HTH
 Robert
 
 
  -Ursprüngliche Nachricht-
  Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
  Gesendet: Freitag, 27. Juni 2003 11:15
  An: Struts Users Mailing List
  Betreff: error handling
 
 
   Hi,
 
  Can anyone send me a solution for the following
  problem:
   From two jsps, I am coming to the same action class. (in the
  first jsp, I have a link, clicking on
   this will go to an action say MyAction. From the second jsp
  also, I can goto the same action
   MyAction). In the MyAction class, how do I write code to
  return to the parent page when error
   occurs. (I am catching error using ActionErrors)
 
   action
 path  = /MyAction
 type = mypackage.MyAction
 name = myFormBean
 scope = session
 forward name=success path=/pages/Result.jsp /
   /action
 
 
   Here, if the forward is success, i am able to got
  Result.jsp. But if any error is there, how do I
   display the error in the parent page? (I can come to this
  action from two different parent page)
   Please advise.
 
 
   Thanks,
 
 
   Pramod
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 
 This  electronic  mail  message  is  intended  solely  for  
 the  named  recipients  and  may contain
 confidential  and  proprietary  business information of 
 eFunds Corporation and all its subsidiaries.
 If  you  are  not a named recipient, please notify the sender 
 immediately.  You may not disclose the
 contents  to  any  other  person;  use  this  electronic  
 mail message or its contents for any other
 purpose; or further store or copy its contents in any medium

Re: error handling

2003-06-27 Thread Sandeep Takhar
you will something in the session for this.

I modified the workflow stuff to handle this
situation.

If a mapping has more than one path to it -- then you
have to override default behaviour in order to get to
the calling mapping.

I am thinking now that it would have been easier to
specify a different mapping that handles the return
differently.  This would force me to make sure my
back-end access is re-usable however.

sandeep


--- Prashanth.S [EMAIL PROTECTED] wrote:
 ya
 I agree with nicolas.But is there any way of  doing
 it typically THE STRUTS WAY???
 cheers
 Prashanth
 
 Nicolas De Loof [EMAIL PROTECTED] wrote:
 
  But by doing in this way, for the forward
 name=failure I will always end up in
 StatuicUpload.jsp
  (for the below example) I don't want to goto that
 jsp. I need to goto the parent page.
  Let me explain the scenario once again. From two
 different jsps (say a.jsp and b.jsp) I am coming to
  an action (bt clicking the link in each jsp). From
 this action, upon an error I want to go back to
  a.jsp (if the request came from a.jsp) or to
 b.jsp (if the request came from b.jsp). So here I
  won't be able to hard code the path either as
 a.jsp or as b.jsp in the struts-config.xml. In
  you example upon error, it will always forward to
 StaticUpload.jsp
 
  Thanks,
  Pramod
 
 If you really cannot set multiples action-mappings
 in struts-config.xml (that is the cleaner way to
 do), you can add a
 parameter to your request for the incoming JSP :
 
 
 
 and build a new forward in your action when errors
 occurs :
 
 if (!errors.isEmpty()) {
 saveErrors(request, errors);
 String commingFrom = request.getParameter(from);
 return new ActionForward(from);
 }
 
 
 Nico.
 
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 
 
 -
 Do you Yahoo!?
 SBC Yahoo! DSL - Now only $29.95 per month!


__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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



Re: AW: AW: error handling

2003-06-27 Thread Pramod . P

Excellent catch :-) in fact I forgot to put the 'input' attribute.
Now everything is working fine!!!

Thanks you very much Robert!!!

Today is the first day for the rest of your life


   

sem.Gottofrey@ 

bkw-fmb.ch   To: [EMAIL PROTECTED] 
   
 cc:   

06/27/2003   Subject: AW: AW: error handling   

04:40 PM   

Please respond 

to Struts 

Users Mailing  

List  

   

   





Hi Pramod,

did you add the 'input' attribute to your mapping?

If yes, I don't know what's wrong with it.
I assume that you are using struts 1.1, are you?

The 'old' way to do it was 'return new ActionForward(mapping.getInput())', I
think.
May be you could try this as well.


Cheers
Robert

 -Ursprüngliche Nachricht-
 Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Gesendet: Freitag, 27. Juni 2003 13:01
 An: Struts Users Mailing List
 Betreff: Re: AW: error handling



 Thank you Robert.
 But, the mapping.getInputForward gives me an output like this:
 reached here...failure
 actionForward :
 ForwardConfig[name=null,path=null,redirect=false,contextRelati
 ve=false]

 But, by giving two mappings in the struts-config, I was able
 to solve the probelm for the time
 being. Instead of mapping.getInputForward, I am setting one
 more forward name? for each action
 mapping to handle the failure case.

 I don't understand why the mapping.getInputForward returns
 null. Please let me know if u have any
 clue.

 Thanks for the idea!!!
 Pramod





 sem.Gottofrey@

 bkw-fmb.ch   To:
 [EMAIL PROTECTED]
  cc:

 06/27/2003   Subject: AW:
 error handling
 03:36 PM

 Please respond

 to Struts

 Users Mailing

 List









 Hi Pramod,

 One solution would be to define two different action mapings
 as follows:

   action
path  = /MyActionFromMyFirstJsp
type  = mypackage.MyAction
name  = myFormBean
scope = session
input =/pages/myFirst.jsp
 forward name=success path=/pages/Result.jsp /
   /action

   action
path  = /MyActionFromMySecondJsp
type  = mypackage.MyAction
name  = myFormBean
scope = session
input =/pages/mySecond.jsp
 forward name=success path=/pages/Result.jsp /
   /action


In your action you then use 'return
 mapping.getInputForward()' in case of
 error.

 HTH
 Robert


  -Ursprüngliche Nachricht-
  Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
  Gesendet: Freitag, 27. Juni 2003 11:15
  An: Struts Users Mailing List
  Betreff: error handling
 
 
   Hi,
 
  Can anyone send me a solution for the following
  problem:
   From two jsps, I am coming to the same action class. (in the
  first jsp, I have a link, clicking on
   this will go to an action say MyAction. From the second jsp
  also, I can goto the same action
   MyAction). In the MyAction class, how do I write code to
  return to the parent page when error
   occurs. (I am catching error using ActionErrors)
 
   action
 path  = /MyAction
 type = mypackage.MyAction
 name = myFormBean
 scope = session
 forward name=success path=/pages/Result.jsp /
   /action
 
 
   Here, if the forward is success, i am able to got
  Result.jsp. But if any error is there, how do I
   display the error in the parent page? (I can come to this
  action from two different parent page)
   Please advise.
 
 
   Thanks,
 
 
   Pramod

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




 
 This  electronic

error handling

2003-03-19 Thread michael wimmer
Hi,

being pretty new to Sturts, I just finished a simple form with the
according FormBean and Action classes.

Now I face the problem, that I should display the error Text if an entry
is missing and change the style of the input field.

html:errors property=.../ works fine for displaying the error
message, but I was just wondering if there is a way to determine if
there is an error set for the property. e.g. storing the errortext in a
variable before displaying and changing the style of the field depending
if the variable is empty or not.

regards,

Michael


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



DispatchAction error handling how to?

2003-01-26 Thread Johan Kumps
Hi all,

Can somebody please trow a light on error handling using a  DispatchAction.
The class org.apache.struts.actions.DispatchAction in Struts  1.1b2 is
catching an InvocationTargetException. So when the 'dispatchMethod' invokes
a method that throws an exception, it's catched here.

How can I do some specific error handling? I don't want to code any catches
in my action classes. How can I catch an exception in my DispatchAction?

Why is org.apache.struts.actions.DispatchAction catching an
InvocationTargetException?

Kind regards,
---
This mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.445 / Virus Database: 250 - Release Date: 21/01/2003


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




Re: DispatchAction error handling how to?

2003-01-26 Thread Rick Reumann
On Sun, Jan 26,'03 (09:43 PM GMT+0100), Johan wrote: 

 Hi all,
 
 Can somebody please trow a light on error handling using a 
 DispatchAction. The class org.apache.struts.actions.DispatchAction in
 Struts  1.1b2 is catching an InvocationTargetException. So when the
 'dispatchMethod' invokes a method that throws an exception, it's
 catched here.
 
 How can I do some specific error handling? I don't want to code any
 catches in my action classes. How can I catch an exception in my
 DispatchAction?
 
 Why is org.apache.struts.actions.DispatchAction catching an
 InvocationTargetException?

Are you using beta3 of struts1.1? If so you could use declarative
exception handling in your config.xml just like you would for any other
action. It works perfectly. Let me know if you have any more questions.


-- 
Rick

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




RE: DispatchAction error handling how to?

2003-01-26 Thread Johan Kumps
Hi,

No I'm using beta 2 of Struts. I'll try to use beta 3

I keep you in touch.

Kind regards,

-Oorspronkelijk bericht-
Van: Rick Reumann [mailto:[EMAIL PROTECTED]]
Verzonden: zondag 26 januari 2003 22:27
Aan: Struts Users Mailing List
Onderwerp: Re: DispatchAction error handling how to?


On Sun, Jan 26,'03 (09:43 PM GMT+0100), Johan wrote:

 Hi all,

 Can somebody please trow a light on error handling using a
 DispatchAction. The class org.apache.struts.actions.DispatchAction in
 Struts  1.1b2 is catching an InvocationTargetException. So when the
 'dispatchMethod' invokes a method that throws an exception, it's
 catched here.

 How can I do some specific error handling? I don't want to code any
 catches in my action classes. How can I catch an exception in my
 DispatchAction?

 Why is org.apache.struts.actions.DispatchAction catching an
 InvocationTargetException?

Are you using beta3 of struts1.1? If so you could use declarative
exception handling in your config.xml just like you would for any other
action. It works perfectly. Let me know if you have any more questions.


--
Rick

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


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.445 / Virus Database: 250 - Release Date: 21/01/2003

---
This mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.445 / Virus Database: 250 - Release Date: 21/01/2003


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




RE: DispatchAction error handling how to?

2003-01-26 Thread Johan Kumps
Could you please help me with an example of error handling using a
dispatchAction using the declarative exception handling?

Many thanks in advance,

Kind regards

-Oorspronkelijk bericht-
Van: Johan Kumps [mailto:[EMAIL PROTECTED]]
Verzonden: zondag 26 januari 2003 22:29
Aan: Struts Users Mailing List
Onderwerp: RE: DispatchAction error handling how to?


Hi,

No I'm using beta 2 of Struts. I'll try to use beta 3

I keep you in touch.

Kind regards,

-Oorspronkelijk bericht-
Van: Rick Reumann [mailto:[EMAIL PROTECTED]]
Verzonden: zondag 26 januari 2003 22:27
Aan: Struts Users Mailing List
Onderwerp: Re: DispatchAction error handling how to?


On Sun, Jan 26,'03 (09:43 PM GMT+0100), Johan wrote:

 Hi all,

 Can somebody please trow a light on error handling using a
 DispatchAction. The class org.apache.struts.actions.DispatchAction in
 Struts  1.1b2 is catching an InvocationTargetException. So when the
 'dispatchMethod' invokes a method that throws an exception, it's
 catched here.

 How can I do some specific error handling? I don't want to code any
 catches in my action classes. How can I catch an exception in my
 DispatchAction?

 Why is org.apache.struts.actions.DispatchAction catching an
 InvocationTargetException?

Are you using beta3 of struts1.1? If so you could use declarative
exception handling in your config.xml just like you would for any other
action. It works perfectly. Let me know if you have any more questions.


--
Rick

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


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.445 / Virus Database: 250 - Release Date: 21/01/2003

---
This mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.445 / Virus Database: 250 - Release Date: 21/01/2003


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


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.445 / Virus Database: 250 - Release Date: 21/01/2003

---
This mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.445 / Virus Database: 250 - Release Date: 21/01/2003


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




RE: Error Handling Database constraints

2003-01-09 Thread Krishnakumar N
I think the database constraints are anyway necessary unless your database
is set up for table level locking or with isolation level serializable as it
would be possible for another txn to insert the record after your first
txn's select. Since these constraints exist in the database, the
corresponding exceptions need to be caught and handled, I guess.

Cheers,
Krishna

-Original Message-
From: Alireza Fattahi [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 09, 2003 4:41 PM
To: 'Struts Users Mailing List'
Subject: Error Handling Database constraints 


Hi, 

As we know there are two types of errors.

1) The user input error, for example and email without @. Well this can be
handled easily and *separately from code* by commons validation frame work

2) The errors that violate the database consistency. For example in the user
table the user_name filed must be unique. The thing we do is: first we add a
constraint to database for user_name. Then when an insert requests first we
select user_name from database to see if there is any duplicate. Well it
means that we handle the constraint checking task our selves with java code.
Why do we do this? Why did we just let the insert happens and work with
SQLException? Because the returned error from database can not be handled or
modified nicely. These errors are changed for each database.
 
Are we doing the right way? Is there any better way available for error
handling Database Constraints? 


Alireza.

--
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]




RE: Error Handling Database constraints

2003-01-09 Thread Robert Taylor
Alireza,

I haven't tried this, but it seems like if you created a
base database exception class that had the ability to
parse the SQLException messages and return the appropriate
application level exception, it might address your needs.


robert

 -Original Message-
 From: Alireza Fattahi [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, January 09, 2003 6:11 AM
 To: 'Struts Users Mailing List'
 Subject: Error Handling Database constraints


 Hi,

 As we know there are two types of errors.

 1) The user input error, for example and email without @. Well this can be
 handled easily and *separately from code* by commons validation frame work

 2) The errors that violate the database consistency. For example
 in the user
 table the user_name filed must be unique. The thing we do is:
 first we add a
 constraint to database for user_name. Then when an insert
 requests first we
 select user_name from database to see if there is any duplicate. Well it
 means that we handle the constraint checking task our selves with
 java code.
 Why do we do this? Why did we just let the insert happens and work with
 SQLException? Because the returned error from database can not be
 handled or
 modified nicely. These errors are changed for each database.

 Are we doing the right way? Is there any better way available for error
 handling Database Constraints?


 Alireza.

 --
 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]




Error Handling Database constraints

2003-01-09 Thread Alireza Fattahi
Hi, 

As we know there are two types of errors.

1) The user input error, for example and email without @. Well this can be
handled easily and *separately from code* by commons validation frame work

2) The errors that violate the database consistency. For example in the user
table the user_name filed must be unique. The thing we do is: first we add a
constraint to database for user_name. Then when an insert requests first we
select user_name from database to see if there is any duplicate. Well it
means that we handle the constraint checking task our selves with java code.
Why do we do this? Why did we just let the insert happens and work with
SQLException? Because the returned error from database can not be handled or
modified nicely. These errors are changed for each database.
 
Are we doing the right way? Is there any better way available for error
handling Database Constraints? 


Alireza.

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




Error handling (ServletException)

2002-12-15 Thread Pete Gieser
Is there something special I have to do to handle a ServletException?
No matter what I try, the stack trace always seems to be sent to the 
standard Tomcat error page.  

I've tried configuring global-exceptions in struts-config, but that
doesn't seem to work.  What's the secret?

  global-exceptions
exception handler=org.apache.struts.action.ExceptionHandler
   key=global.error.message 
   path=/error 
   scope=request
   type=javax.servlet.ServletException /
  /global-exceptions

javax.servlet.ServletException: BeanUtils.populate
at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:980)
at
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcess
or.java:779)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
246)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)

Thanks!
Pete


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




Re: Error handling (ServletException)

2002-12-15 Thread Dan Tran
Your action throws an Exception which got rethrow as ServletException by the
controller if the original exception is not caught by your handler.

So you need to change your configuration to catch Exception ( or whatever
the real one is) not ServletException.

Hope this helps.

-D
- Original Message -
From: Pete Gieser [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, December 15, 2002 12:54 AM
Subject: Error handling (ServletException)


 Is there something special I have to do to handle a ServletException?
 No matter what I try, the stack trace always seems to be sent to the
 standard Tomcat error page.

 I've tried configuring global-exceptions in struts-config, but that
 doesn't seem to work.  What's the secret?

   global-exceptions
 exception handler=org.apache.struts.action.ExceptionHandler
key=global.error.message
path=/error
scope=request
type=javax.servlet.ServletException /
   /global-exceptions

 javax.servlet.ServletException: BeanUtils.populate
 at
 org.apache.struts.util.RequestUtils.populate(RequestUtils.java:980)
 at
 org.apache.struts.action.RequestProcessor.processPopulate(RequestProcess
 or.java:779)
 at
 org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
 246)
 at
 org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292)
 at
 org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)

 Thanks!
 Pete


 --
 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]




RE: about html:error ( error handling )

2002-11-13 Thread Alex Almero
could you post a sample code tnx

aalmero

-Original Message-
From: wolfgang [mailto:wolfgang127jp;ybb.ne.jp]
Sent: Wednesday, November 13, 2002 3:01 AM
To: Struts Users Mailing List
Subject: Re: about html:error ( error handling )


Hi there,

Finally, I figured it out.
Actually the way is just not to use struts tag libraries. ;(
Get the ActionErrors and search the key.
if there's an object corresponding to the key, write FF
if no, write FF

thank you.
wolfgang

-- 
wolfgang [EMAIL PROTECTED]


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

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




about html:error ( error handling )

2002-11-12 Thread wolfgang
Hi there,

I'm trying to make an error handling in my web application with 
logic:present and html:errors.
but I'm stuck.

what I wanna do is that 
when struts catch the error (user didn't fill in the required textarea) ,
struts say there's an error.
And
even though there were no errors, strust says there was No error.

now I can do only former one with the code below...

In ApplicationResource.properties file --
username.required=FF   (-- red color in html)
-

In ActionForm bean --
ActionErrors errors = new ActionErrors();
if(.){
   errors.add(username, new ActionError(username.required));
}

-

In jsp --
logic:present name=%=Action.ERROR_KEY%
   html:errors property=username
/logic:present
-

when struts catches the error, the HTML( transformed from jsp ) write
out FF.

I want struts write a word I specified even though There's NO error.
Is it impossible ???

why I wanna do this is that I wanna change the font's color depending on
either error or not.

If there's error font color=fffoobar/font
If there's NO error font color=fffoobar/font

I tried coding in jsp.

font color=
logic:present name=%=Action.ERROR_KEY%
   html:errors property=username
/logic:present
logic:notPresent name=%=Action.ERROR_KEY%
   F
/logic:notPresent
foobar/font

This does NOT work because if username property is okay , but other
properties got errors, html:errors property=username will be
processed...

so I gotta do like below...(since I don't know how to code, I just write
words)

font color=
logic:present name=%=Action.ERROR_KEY%
   if(this error is username property's one){
  html:errors property=username
   }else{
  write F
   }
/logic:present
logic:notPresent name=%=Action.ERROR_KEY%
   F
/logic:notPresent
foobar/font


I don't know how to code

Please Please anyone helps me out...

Thanks in advance.
wolfgang



-- 
wolfgang [EMAIL PROTECTED]


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




RE: about html:error ( error handling )

2002-11-12 Thread Mouratidis, Georg
hi wolfgang,

you do not have to go this way.

1. in the struts-config.xml add in your appropriate action the attribute 
validate=true.
2. in your actionformbean there is (has to be ) a method called validate().
inside this method you only add your ActionsErrors object.

If there is not error you have to return null
else you have to return your ActionErrors object.

i work this way and it works on my system.


 public ActionErrors validate(ActionMapping mapping,
   HttpServletRequest request) {

  ActionErrors errors = new ActionErrors();
  if ((username == null) || (username.length()  1))
  errors.add(username, new ActionError(login.error.username.required));
  if ((password == null) || (password.length()  1))
  errors.add(password, new ActionError(login.error.password.required));
  if ((organization == null) || (organization.length()  1))
  errors.add(organization, new 
ActionError(login.error.organization.required));
  if ((language == null) || (language.length()  1))
  errors.add(language, new ActionError(login.error.language.required));

  return errors;

  }

hopefully i could help you

-Original Message-
From: wolfgang [mailto:wolfgang127jp;ybb.ne.jp]
Sent: Dienstag, 12. November 2002 16:33
To: Struts Users Mailing List
Subject: about html:error ( error handling )


Hi there,

I'm trying to make an error handling in my web application with 
logic:present and html:errors.
but I'm stuck.

what I wanna do is that 
when struts catch the error (user didn't fill in the required textarea) ,
struts say there's an error.
And
even though there were no errors, strust says there was No error.

now I can do only former one with the code below...

In ApplicationResource.properties file --
username.required=FF   (-- red color in html)
-

In ActionForm bean --
ActionErrors errors = new ActionErrors();
if(.){
   errors.add(username, new ActionError(username.required));
}

-

In jsp --
logic:present name=%=Action.ERROR_KEY%
   html:errors property=username
/logic:present
-

when struts catches the error, the HTML( transformed from jsp ) write
out FF.

I want struts write a word I specified even though There's NO error.
Is it impossible ???

why I wanna do this is that I wanna change the font's color depending on
either error or not.

If there's error font color=fffoobar/font
If there's NO error font color=fffoobar/font

I tried coding in jsp.

font color=
logic:present name=%=Action.ERROR_KEY%
   html:errors property=username
/logic:present
logic:notPresent name=%=Action.ERROR_KEY%
   F
/logic:notPresent
foobar/font

This does NOT work because if username property is okay , but other
properties got errors, html:errors property=username will be
processed...

so I gotta do like below...(since I don't know how to code, I just write
words)

font color=
logic:present name=%=Action.ERROR_KEY%
   if(this error is username property's one){
  html:errors property=username
   }else{
  write F
   }
/logic:present
logic:notPresent name=%=Action.ERROR_KEY%
   F
/logic:notPresent
foobar/font


I don't know how to code

Please Please anyone helps me out...

Thanks in advance.
wolfgang



-- 
wolfgang [EMAIL PROTECTED]


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


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




Re: about html:error ( error handling )

2002-11-12 Thread wolfgang
Hi Mouratidis,

Thank you for replying me.

but unfortunately that's not what I wanted to know.

I wasn't asking how to just handle errors.

thank you.
wolfgang


-- 
wolfgang [EMAIL PROTECTED]


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




Re: about html:error ( error handling )

2002-11-12 Thread wolfgang
Hi there,

Finally, I figured it out.
Actually the way is just not to use struts tag libraries. ;(
Get the ActionErrors and search the key.
if there's an object corresponding to the key, write FF
if no, write FF

thank you.
wolfgang

-- 
wolfgang [EMAIL PROTECTED]


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




[STRUTS] Form error handling

2002-09-17 Thread kiuma

Hello,
mine is a newbie question:

When validate fails i put some code like this:

newError = new ActionError(myform.error, )
errors.add( ActionErrors.GLOBAL_ERROR, newError );

in my properties file I put the key relative to myform.error.

in struts-config.xml

action name=listedUserForm input=/secure/userlist.jsp 
path=/listedUser type=com.wingstech.webappointments.ListedUserAction 
parameter=action validate=true
forward name=Success path=/secure/userlist.jsp 
redirect=true /
/action  

When validate() returns error, struts should dirve me to input page.

How can I parse errors in my jsp page, then?

thanks,
kiuma



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




Re: [STRUTS] Form error handling

2002-09-17 Thread tnist

Kiuma,

You can use one of the following:
html:error/ tag:

If placed at the top of a page, this will cause the errors to be displayed 
there.  You should also ensure that errors.header and errors.footer messages are 
defined in your application resources file.  This will help in the formatting of the 
resulting error messages.  Something like:
 error.header=ul
 error.footer=/ul

You could also use the validator tag which comes with the Struts Validation extension. 
 It works similar except it acts as an iterator over all error messages.
 validator:errorsExist
 ul
 validator:errors id=error
 libean:write name=error//li
 /validator:errors
 /ul
 /validator:errorsExist

There is a good write up on this provide by Ted Husted, Struts Tip #17.  You can 
obtain a copy by joining the mvc-programmers forum hosted by BaseBeans.com.

Hope that helps.

Regards,

Todd G. Nist



 
 From: kiuma [EMAIL PROTECTED]
 Date: 2002/09/17 Tue AM 07:00:28 EDT
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Subject: [STRUTS] Form  error handling
 
 Hello,
 mine is a newbie question:
 
 When validate fails i put some code like this:
 
 newError = new ActionError(myform.error, )
 errors.add( ActionErrors.GLOBAL_ERROR, newError );
 
 in my properties file I put the key relative to myform.error.
 
 in struts-config.xml
 
 action name=listedUserForm input=/secure/userlist.jsp 
 path=/listedUser type=com.wingstech.webappointments.ListedUserAction 
 parameter=action validate=true
 forward name=Success path=/secure/userlist.jsp 
 redirect=true /
 /action  
 
 When validate() returns error, struts should dirve me to input page.
 
 How can I parse errors in my jsp page, then?
 
 thanks,
 kiuma
 
 
 
 --
 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]




URGENT!!! Dynamic parameters in App Resources for error handling

2002-08-31 Thread Tarun Sainanee

Hi all,
I have been pretty happy using struts 1.0.2 for some time now. But now i 
have a problem. Please help.

I know that we can user parameterized messages in the App Resources file 
for error messages. Depending on the no of parameters i can have an 
errors.add() method pass the parameters.
But the problem is that i do not know in advance how many parameters i may 
need to pass? Any workaround guys?

Also is there a way that i can access the message in App Resources File 
and modify it at runtime???

Pointers to a working code would be excellent.


Regards,
Tarun Sainanee
TCS Delhi
--
Finance is the art of passing money from hand to hand until it finally 
disappears.
-- Robert W. Sarnoff



RE: [MessageResources] URGENT!!! Dynamic parameters in App Resources for error handling

2002-08-31 Thread James Mitchell

 -Original Message-
 From: Tarun Sainanee [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, August 31, 2002 11:05 AM

 Hi all,
 I have been pretty happy using struts 1.0.2 for some time now. But now i
 have a problem. Please help.

 I know that we can use parameterized messages in the App Resources file
 for error messages. Depending on the no of parameters i can have an
 errors.add() method pass the parameters.
 But the problem is that i do not know in advance how many
 parameters i may
 need to pass? Any workaround guys?

Instead of using getMessage(key, arg0, arg1, etc, etc

use getMessage(key, args[])



 Also is there a way that i can access the message in App Resources File
 and modify it at runtime???

my-best-guess
The default implementation of MessageResources (PropertyMessageResources)
does not provide for any way to manipulate the underlying HashMap at
runtime.

However, I guess you could hack around this with your own implementation
(not recommended).  Myself and a few others are looking at creating a
JDBCMessageResources that will probably provide a reload method.  So, I
guess, in a way that would allow someone to modify at runtime.
/my-best-guess


 Pointers to a working code would be excellent.


 Regards,
 Tarun Sainanee
 TCS Delhi


Hope that helps

James Mitchell
Software Engineer\Struts Evangelist
Struts-Atlanta, the Open Minded Developer Network
http://www.open-tools.org/struts-atlanta


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




error handling in jsp

2002-08-15 Thread Billy Ng

Hi folks,

I am using struts-template.tld to generate the pages.  For example,

%@ taglib uri='/WEB-INF/struts-template.tld' prefix='template' %
template:insert template='/main_template.jsp'
template:put name='head' content='/templates/head.jsp'
template:put name='content' content='/content.jsp'
template:put name='footer' content='/templates/footer.jsp'
template:insert/

When any exception is thrown in the content.jsp, the page will display with 
header only.  I want to display the error_content.jsp if any eception is 
thrown in content.jsp is caught.  Would anybody please share how you handle 
this, thanks!

Billy Ng

_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


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




Re: error handling in jsp

2002-08-15 Thread Tim T. Young


I would be curious to see if anyone has a design for this.  I fixed it by
moving to Tiles, as it handles errors much better.  It is a little more
complex than straight templates, but it is worth it once you do your first
extends definition and realize the possibilities...

Tim




   
   
Billy Ng 
   
evebill8@hot  
   
mail.com  
   
   
   
08/15/2002 
   
11:29 AM  To: [EMAIL PROTECTED]   
   
Pleasecc:  
   
respond to 
   
Struts Users  
   
Mailing List  
   
 Subject: error handling in jsp
   
   
   



Caterpillar: Confidential Green  Retain Until: 09/14/2002
 Retention Category:  G90 -
 Information and Reports




Hi folks,

I am using struts-template.tld to generate the pages.  For example,

%@ taglib uri='/WEB-INF/struts-template.tld' prefix='template' %
template:insert template='/main_template.jsp'
template:put name='head' content='/templates/head.jsp'
template:put name='content' content='/content.jsp'
template:put name='footer' content='/templates/footer.jsp'
template:insert/

When any exception is thrown in the content.jsp, the page will display with

header only.  I want to display the error_content.jsp if any eception is
thrown in content.jsp is caught.  Would anybody please share how you handle

this, thanks!

Billy Ng

_
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx


--
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]




Error handling philosophy in STRUTS

2002-02-21 Thread Tom Bednarz

Hi,

I am new to Struts and currently in the process of porting a JSP based Web
Application to Struts and Velocity.

Personally I hate stupid error messages like 'Failed to process your
order' or 'Operation failed '. These type of messages are absolutely
useless. For simple applications that simply store and retrieve data from a
database it is possible do define possible error messages in advance and
store them in a resource file. It is impossible in a distributed
environment.

When I look at samples and at the API I see that you offer ActionErrors and
ActionError to process Errors. The real Error message is stored in a
resource File and you pass a key to the ActionError class which then
retrieves the message from the resource file. This is a nice feature in
multi-language environments but in a distributed environment it is not
possible know all possible error messages.

I run a lot of CORBA stuff and have a lot of business logic implemented in
various CORBA servers running on Windows and UNIX boxes. I have beans that
wrap the CORBA clients and these beans are used in Action objects.

There are many places where things can go wrong in a distributed application
environment. I consequently use exeption handling and put all error messages
in the exception itself. Since CORBA knows exceptions many exceptions are
already defined on the IDL level. The server implementation (usually written
in C++) fills human readable error messages in the exception object. Finally
exactly these messages should be displayed on an end-users browser.

I think the concept of displaying the error message on top of a form very
good, since a user has a chance to correct the entries made if the error is
caused by a typo. If there is a technical problem (such as a network beeing
down, or a service such as a credit card validation or anything else on a
remote location is not available) then I have at least a chance to return a
meaningful error message. If I have to store messages in a resource file I
could simply return something like Operation failed. This is not very
usefull for either the end-user nor any support staff.

I don't know what the philosophy of Error handling in struts is, but for
distributed applications it would be nice if there would be a possibility to
simply add a string to the ActionError object and then add it to the array
of errors.

Are there any reasons why this functionality is not available? A workaround
is simple, I can put error messages in a request or session context and then
display it in a velocity macro. But I think that this feature is something
that would well suite for the framework.


Thanks

Thomas


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




Customised Error handling

2001-11-19 Thread Anthony Chater

The HTMLErrors tag handles validation errors well and of course I can load
other text messages into an  ActionError and present them via an HTML:errors
tag. 
But I need to have at least one other category of  error message. 
 Is there a built-in mechanism for doing this or do I have to write my own
tag?



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




RE: Customised Error handling

2001-11-19 Thread Alexander Jesse

Hi,

if you need special formatting for the errors: have a look at the validator
error-tags. (in the nightly build or via ted's page 

hope this helps
Alexander

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 19, 2001 12:04 PM
To: [EMAIL PROTECTED]
Subject: Customised Error handling


The HTMLErrors tag handles validation errors well and of course I can load
other text messages into an  ActionError and present them via an HTML:errors
tag. 
But I need to have at least one other category of  error message. 
 Is there a built-in mechanism for doing this or do I have to write my own
tag?



--
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]




Error handling with taglibs

2001-05-11 Thread Mike Prader



Hi all

My problem is, that I want to mark a textfield red 
and set the focus
to it after I checked the fields in my from the 
ActionClass derived class and I detected an
error in this input.
I want to use taglibs also.

Is there any possibility to do this in my from the 
ActionForm Class derived class, so that Struts will
automatically set this field to another colour and 
set the focus to it ?If not 
whatis
the best solution to mark theattribute in my 
from the ActionForm Class derived Class that this field
isn't ok ?

regards

mike


RE: Error handling with taglibs

2001-05-11 Thread Nanduri, Amarnath



You 
need to hack in...and do some dirty work on each jsp page...

You 
need to write your own html:error tag . Whenever there are some errors 
to be shown, you simply use some javascript to send focus to the first error 
field. Also in your jsp page (for evey text field) you might want to do 
something like an if,else condition.. If no error show plain, else 
show in red font with the error msg. Hope this helps.

cheers,
Amar..

  -Original Message-From: Mike Prader 
  [mailto:[EMAIL PROTECTED]]Sent: Friday, May 11, 2001 10:13 
  AMTo: [EMAIL PROTECTED]Subject: Error 
  handling with taglibs
  Hi all
  
  My problem is, that I want to mark a textfield 
  red and set the focus
  to it after I checked the fields in my from the 
  ActionClass derived class and I detected an
  error in this input.
  I want to use taglibs also.
  
  Is there any possibility to do this in my from 
  the ActionForm Class derived class, so that Struts will
  automatically set this field to another colour 
  and set the focus to it ?If not 
  whatis
  the best solution to mark theattribute in 
  my from the ActionForm Class derived Class that this field
  isn't ok ?
  
  regards
  
  mike


Re: Error handling with taglibs

2001-05-11 Thread Tony Karas

I would suggest requesting a change to the current struts implementation.  I 
think this has been thought about because there is the facility to include 
the property that has caused the error.  I would also like to do something 
like this.

I suppose there would be at least two ways of going about it:

1) Make the ActionErrors component more accessible in the jsp page - so that 
some kind of logic tag could be used to generate either a normal html:text 
tag or an html:text error tag, or

2) Add an error attribute to the html:text tag (and others) that would 
render the text box differently if an error is associated with it.

These are my thoughts.

Cheers
Tony

From: Scott Walter [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: Error handling with taglibs
Date: Fri, 11 May 2001 08:02:18 -0700 (PDT)

I have thought about this myself, just a rough guess
but you could modify the struts input tags (such as
the textfield) to do:

1.  Search through the errors vector to see if it
applies to the current property
2.  Set background color to the text field to red or
something like that.

scott.
--- Mike Prader [EMAIL PROTECTED] wrote:
  Hi all
 
  My problem is, that I want to mark a textfield red
  and set the focus
  to it after I checked the fields in my from the
  Action Class derived class and I detected an
  error in this input.
  I want to use taglibs also.
 
  Is there any possibility to do this in my from the
  ActionForm Class derived class, so that Struts will
  automatically set this field to another colour and
  set the focus to it ? If not what is
  the best solution to mark the attribute in my from
  the ActionForm Class derived Class that this field
  isn't ok ?
 
  regards
 
  mike
 


=
~~~
Scott

__
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.