In fact there is always an actionError object.
When trying to debug I used request.getParameterNames instead of
request.getAttributeNames
So using
<%
org.apache.struts.action.ActionErrors ae =
(org.apache.struts.action.ActionErrors)request.getAttribute(org.apache.struts.Globals.ERROR_KEY);
System.out.println("ae.size()="+ae.size());
for (java.util.Iterator e = ae.get ("login.password") ; e.hasNext() ;) {
org.apache.struts.action.ActionError aerr =
(org.apache.struts.action.ActionError)e.next();
System.out.println(aerr.getKey());
}
%>
Wich outputs
ae.size()=1
error.mandatory.login.password
So, the issue is with the <html:errors/> tag itself
Olivier Citeau <[EMAIL PROTECTED]> a écrit :
Hi Tim,
In fact no action is involved, only a form and a jsp.
In struts-config.xml I have validate=true
So Struts calls from.validate() which returns a non empty ActionErrors object.
Since ActionErrors object is non empty, both version of Struts redirect to the
same jsp page and do not call the action.
So I should use saveErrors in form.validate() too ?
It seems to me that the different behaviour is due too change of struts
version, not websphere version.
A strange thing is that when I add the following to thh jsp of my working web
application (aka old struts), there is no error object :
for (java.util.Enumeration e = request.getParameterNames() ;
e.hasMoreElements() ;) {
System.out.println(e.nextElement());
}
%>
"Slattery, Tim - BLS" a écrit :
> Now here is my issue.
> In the form, if the user forgets a mandatory field, I do
> something like :
> errors.add (...
> ...
> return errors
If I'm following correctly, this returns an ActionErrors collection to
your Action.
> I do not use saveErrors(), because I use it only in the action.
If you don't use saveErrors, then the ActionErrors collection doesn't
get saved, and you don't get any error messages.
> With WSAD/ Struts 1.0 it works fine : stay on same page and
> display errors.
> With RSA/Struts 1.1 it stay on same page and display nothing.
---------------------------------
Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs
exceptionnels pour appeler la France et l'international.Téléchargez la version
beta.