You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ricardo Andres Quintero <rq...@ubiquando.com.co> on 2004/10/13 16:41:41 UTC
Re: Newbie never displays errors
it would be nice to have the form's action, and the action mapping of that
form's ation.
On Wed, 13 Oct 2004 11:10:51 -0400, Nadia Kunkov wrote
> Hi,
>
> I have gone through multiple postings and followed the suggestions
> about displaying the errors. I just need another pair of eyes to
> look at this, I'm probably missing something.
>
> I can't display errors on the page. I know that I go through the
> validate method and it finds errors because I'm not moving to the
> next page when I do a submit. If I have an error I want to stay on
> the same page and let the user resubmit. I do stay on the same page
> but under the form I want error messages to be displayed and they
> are never there. Please take a look below.
>
> I have this in my MyAppResources.properties which resides in /WEB-
> INF/classes directory errors.required={0} is required.
>
> in my struts-config.xml I have
> validate="true"
>
> and also
> <message-resources
> parameter="MyAppResources"
> null="false"/>
>
> In my ActionForm I have the following in the Validate method:
>
> public ActionErrors validate (ActionMapping actionMapping,
> HttpServletRequest httpServletRequest) { ActionErrors errors =
> new ActionErrors(); if (getCountryName() == null ||
> getCountryName().length() < 1) { errors.add("countryName", new
> ActionError("errors.required","Country Name")); } if
> (getCountryCapital() == null || getCountryCapital().length() < 1)
> { errors.add("countryCapital", new ActionError("errors.required",
> "Country Capital")); } return errors; }
>
> In my jsp file I have the following
> .....some stuff......
>
> <form:submit property="method" value="Add"></form:submit>
> </form:form>
> <html:errors/>
> </body>
> </html:html>
>
> Thanks for your help.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
--
Ricardo Andrés Quintero R.
Ubiquando Ltda.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org