struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ManiKanta G <>
Subject Re: validation problem
Date Wed, 25 Jun 2008 12:21:49 GMT
Anshu Dhamija wrote:
> hi
>    i am new to struts 2.i am facing problem in performing validation through
> xml
> actually i want to display message at the top of my form instaed of at field
> level
> can anyone please help me

In struts2 there is a provision for handling the error messages by field 
and action level.

If the message u want to display is not related to any particular field, 
then u can use *<s:actionerrors />* tag at the top of ur page.

If the validation message is particular to a field, u can use 
*<s:fielderrors />* tag at the top of the page. This will displays all 
the field validation errors.
To display validation errors specific to a field, use *<s:fielderrors /> 
tag with <s:param>*, like below


Like this u can place individual field errors in ur custom layout in ur 
way, using tables, divs or something else.

When you explore the validation framework, what u see is more types of 
validation, which includes field validatiors & non-field validators.

Field validators are specific to a field, and thus adds a field error.
Non-field validators are NOT specific to any single field and thus the 
error message will be added as action level error (action error).

U can get more info regarding validations from Struts2 documentation.

Feel free to ask if u've need any clarification.

ManiKanta G

********** DISCLAIMER **********
Information contained and transmitted by this E-MAIL is proprietary to 
Sify Limited and is intended for use only by the individual or entity to 
which it is addressed, and may contain information that is privileged, 
confidential or exempt from disclosure under applicable law. If this is a 
forwarded message, the content of this E-MAIL may not have been sent with 
the authority of the Company. If you are not the intended recipient, an 
agent of the intended recipient or a  person responsible for delivering the 
information to the named recipient,  you are notified that any use, 
distribution, transmission, printing, copying or dissemination of this 
information in any way or in any manner is strictly prohibited. If you have 
received this communication in error, please delete this mail & notify us 
immediately at

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