Is your problem server side or client side?  If you problem is client side
then you should read the struts javadocs:

http://struts.apache.org/1.2.7/api/org/apache/struts/validator/ValidatorPlug
In.html

Or the User Guides:
http://struts.apache.org/1.x/faqs/validator.html

Both of them mention a plugin property "stopOnFirstError":

<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
  <set-property property="pathnames"
   value="/WEB-INF/validator-rules.xml,/WEB-INF/validations.xml"/>
  <set-property property="stopOnFirstError" value="false"/>
</plug-in>

*****
Also, if you want to use the errorStyleClass with your validation I think I
understand your problem now.  At the very bottom of this letter I left in a
copy of the code you described using in your dispatch action.  You save
errors with 'saveMessages(request, messages);' which presumably saves
messages in the Globals.MESSAGE_KEY.  If you switch to 'saveErrors(request,
messages);' then it will save them in the Globals.ERROR_KEY which is used by
the errorStyleClass so it should be able to detect you have an ERROR and
automatically insert the html for "class='errorMsg'" whenever an error is
found.  For more information see this link where they talk about ERRORS and
MESSAGES being saved under different keys, as I've mentioned in my previous
posts:
http://struts.apache.org/1.x/struts-core/apidocs/org/apache/struts/action/Ac
tion.html

Regards,
David

>On 7/19/06, fea jabi <[EMAIL PROTECTED]> wrote:
>>Yah, in the JSP where the errorStyleClass is working I am using
>><html:errors
>>property="name"/>
>>
>>So, do I have to use html:errors? not html:messages?
>>
>>yes, I am using DynaValidatorForm but calling validate from action class.
>>The validation is done in validator.xml
>>
>>In dispath action class I have
>>ActionMessages messages = (ActionMessages)frm.validate( mapping, request
>>);
>>         if ( messages != null && !messages.isEmpty() ) {
>>             saveMessages(request, messages);
>>             return (mapping.findForward("validationFailed"));
>>         }
>>
>>Should I be saving action errors instead of ActionMessages?
>>
>>Thanks.


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

Reply via email to