struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From RathinaGanesh MeenakshiSundaram <rathinagan...@gmail.com>
Subject Re: ErrorStyleClass
Date Wed, 04 Jan 2006 16:48:40 GMT
Niall,

I do the same thing you say, except that, Iam storing them as "
ActionErrors.GLOBAL_ERROR"
This is what, I have in the validate method ....

 if ((lastName == null) || (lastName.trim().length() == 0)) {
            errors.add("ActionErrors.GLOBAL_ERROR", new ActionMessage("
error.login.nolastname"));
 }

After, I execute the page, when I see the source code it just has the <input
type="text" class="login"> rather than <input type="text"
class="loginERROR">

Any Idea..??

Also, what do you mean by "message associated with the "lastName" property."
This is what, I have for the lastName in Application Resources.properties

error.login.nolastname=<li class="shorterrormsg" style="width:220px;"><label
for="lastname" class="errorlabels">Last name</label> is required.</li>

Thanks,
Ganesh.


On 1/3/06, Niall Pemberton <niall.pemberton@blueyonder.co.uk> wrote:
>
> For the errorStyleClass to be used there need to be a set of
> "ActionMessages" stored under the appropriate key (i.e. Globals.ERROR_KEY)
> and there needs to be a message for the field in error - i.e. in your case
> a
> message associated with the "lastName" property.
>
> If your returning an appropriate set of ActionMessages in your
> ActionForm's
> validate method they'll automatically get stored under the right key and
> you
> just need to make sure the property name for the specific message is set
> correctly. If your not doing this then you need to say how you are
> validating.
>
> Also, when you say "it just has the styleClass" - do you mean it is
> rendering <input type="text" class="login"> rather than <input type="text"
> class="loginERROR">?
>
> Niall
>
> ----- Original Message -----
> From: "RathinaGanesh MeenakshiSundaram" <rathinaganesh@gmail.com>
> Sent: Tuesday, January 03, 2006 8:24 PM
>
>
> Thanks.
> I figured out the issue. I had a different version of struts in another
> app,
> and somehow that was classloader was picking up that older version..
> But, still after I get them right, the text field is not picking up the
> errorStyleClass and just has the styleClass, even incase of error..!
>
> Here is my peice of code..
> <html:text styleClass="login" property="lastName" maxlength="15" size="28"
> styleId="lastname" errorStyleClass="loginERROR" />
>
> Please let me know.
> Thanks,
> Ganesh.
>
> On 1/3/06, Niall Pemberton <niall.pemberton@blueyonder.co.uk> wrote:
> >
> > OK but a "setter" does exist for that property in the <html:text> tag in
> > Struts 1.2.7 and Struts 1.2.8 so somethings wrong in your app somewhere.
> >
> > Niall
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message