Arnaud HERITIER
Mon, 04 Nov 2002 05:46:00 -0800
You can had manually errors in the request : request.setAttribute(ERROR_KEY,errors);
I think it should work. Arnaud > -----Message d'origine----- > De : PALLUEL Sylvie [mailto:sylvie.palluel@;cnamts.fr] > Envoyé : lundi 4 novembre 2002 14:28 > À : 'Struts Users Mailing List'; [EMAIL PROTECTED] > Objet : RE : How to display an error from reset method (ActionForm) ? > > > Hello, > > The problem is that the reset method doesn't return ActionErrors. > > Sylvie. > > > -----Message d'origine----- > > De : Arnaud HERITIER [mailto:aheritier@;sopragroup.com] > > Envoyé : lundi 4 novembre 2002 14:11 > > À : 'Struts Users Mailing List' > > Objet : RE: How to display an error from reset method (ActionForm) ? > > > > You can do it as you did it in the validate method. For exemple : > > > > ActionErrors errors = new ActionErrors(); > > > > if( dateFrom!=null && > > !dateFrom.trim().equals("") && > > !isValideDate(dateFrom) > > ) > > errors.add(Constants.FROM_FIELD_ERROR, new > > ActionError("error.dateformat")); > > if( dateTo!=null && > > !dateTo.trim().equals("") && > > !isValideDate(dateTo) > > ) > > errors.add(Constants.TO_FIELD_ERROR, new > > ActionError("error.dateformat")); > > if(ddelai!=null && !ddelai.trim().equals("")){ > > try{ > > int value = Integer.parseInt(ddelai); > > if(udelai.equals(Constants.LIST_DEFAULT_VALUE)){ > > errors.add(Constants.DELAI_FIELD_ERROR, new > > ActionError("error.unitedelai.missing")); > > } > > if(value<=0) > > errors.add(Constants.DELAI_FIELD_ERROR, new > > ActionError("error.integerformat")); > > }catch(NumberFormatException nfe){ > > errors.add(Constants.DELAI_FIELD_ERROR, new > > ActionError("error.integerformat")); > > } > > } > > > > return errors; > > > > Arno. > > -----Message d'origine----- > > De : PALLUEL Sylvie [mailto:sylvie.palluel@;cnamts.fr] > > Envoye : lundi 4 novembre 2002 14:02 > > A : [EMAIL PROTECTED] > > Objet : How to display an error from reset method (ActionForm) ? > > > > > > Hello, > > > > > > > > I'm using the reset method in a class which inherits from > ActionForm > to > > initialize my form from database. > > > > > > > > This method can fail and generate an error that I want to display > using > > ActionErrors. > > > > How can I do this ? > > > > > > > > Thanks for your help. > > > > > > > > Sylvie. > > > > > > > > > > > > > ********************************************************************** > > This email and any files transmitted with it are confidential and > > intended solely for the use of the individual or entity > to whom they > > are addressed. If you have received this email in error please > notify > > the system manager. > > > > This footnote also confirms that this email message has been swept > by > > MIMEsweeper for the presence of computer viruses. > > > > www.mimesweeper.com > > > ********************************************************************** > > > > ********************************************************************** > This email and any files transmitted with it are confidential and > intended solely for the use of the individual or entity to whom they > are addressed. If you have received this email in error please notify > the system manager. > > This footnote also confirms that this email message has been swept by > MIMEsweeper for the presence of computer viruses. > > www.mimesweeper.com > ********************************************************************** > > -- > 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>