You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by hardc0d3r <ha...@gmail.com> on 2008/02/09 14:46:12 UTC

how to know what error is displayed in jsp

in a form or action class, you can set an ActionError or ActionMessage. i am
wondering if there is a way in jsp that i can know what error occurred in
the validation. for example, the username field is left blank so i will add
it to the errors. i want to be able to highlight that field so that the user
can notice it immediately..
-- 
View this message in context: http://www.nabble.com/how-to-know-what-error-is-displayed-in-jsp-tp15371901p15371901.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: how to know what error is displayed in jsp

Posted by Laurie Harper <la...@holoweb.net>.
Antonio Petrelli wrote:
> 2008/2/9, hardc0d3r <ha...@gmail.com>:
>> in a form or action class, you can set an ActionError or ActionMessage. i am
>> wondering if there is a way in jsp that i can know what error occurred in
>> the validation. for example, the username field is left blank so i will add
>> it to the errors. i want to be able to highlight that field so that the user
>> can notice it immediately..
> 
> Use <html:messages>:
> http://struts.apache.org/1.3.8/struts-taglib/tlddoc/html/messages.html
> 
> Antonio

Or, even easier if you just want to highlight fields that have errors, 
is to use one of the errorStyle/errorStyleClass/errorStyleId attributes 
to associate appropriate CSS rules with that input.

http://struts.apache.org/1.3.8/struts-taglib/tagreference.html#text

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: how to know what error is displayed in jsp

Posted by Antonio Petrelli <an...@gmail.com>.
2008/2/9, hardc0d3r <ha...@gmail.com>:
>
> in a form or action class, you can set an ActionError or ActionMessage. i am
> wondering if there is a way in jsp that i can know what error occurred in
> the validation. for example, the username field is left blank so i will add
> it to the errors. i want to be able to highlight that field so that the user
> can notice it immediately..

Use <html:messages>:
http://struts.apache.org/1.3.8/struts-taglib/tlddoc/html/messages.html

Antonio

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: how to know what error is displayed in jsp

Posted by Dave Newton <ne...@yahoo.com>.
What version of Struts?

--- hardc0d3r <ha...@gmail.com> wrote:

> 
> in a form or action class, you can set an ActionError or ActionMessage. i
> am
> wondering if there is a way in jsp that i can know what error occurred in
> the validation. for example, the username field is left blank so i will add
> it to the errors. i want to be able to highlight that field so that the
> user
> can notice it immediately..
> -- 
> View this message in context:
>
http://www.nabble.com/how-to-know-what-error-is-displayed-in-jsp-tp15371901p15371901.html
> Sent from the Struts - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org