Hi,

In below ways I have tried it.

List<PojoClassBO> fondsList = new ArrayList< PojoClassBO >();

for (int i = 0; i < fundNr.length && fondFlag; i++) {
        if (!CommonValidation.isValidFondsAmount(pension[i], new Locale("nl", 
"NL"))) {
        addFieldError("pension["+i+"]", getText("amount.error").trim());
}

<s:iterator value="fondsList" status="rowStatus">
<s:textfield name="fundNr" />
<s:fielderror cssClass="errorField"><s:param 
value="%{'fundNr[#rowStatus.index]'}" /></s:fielderror>
</s:iterator>

In above code, it showing same error for all rows of fundNr field.

<s:iterator value="fondsList" status="rowStatus">
<s:textfield name="fundNr" />
<s:fielderror cssClass="errorField" name="fundNr[#rowStatus.index]" 
></s:fielderror>
</s:iterator>

For above code, it doesn't showing error mesaage at all.

Plz suggest me is there any other way to try.


Thanks  and Regards,

Satheesh Kannan A B



-----Original Message-----
From: Dave Newton [mailto:davelnew...@gmail.com] 
Sent: Saturday, December 25, 2010 5:45 AM
To: Struts Users Mailing List
Subject: Re: RE: FW: Iterator: field errors.

Did you /try/ using index notation? If you have no way of referring to a
specific element I'm not sure what else to tell you.

Dave
 On Dec 24, 2010 12:02 PM, "Dave Newton" <davelnew...@gmail.com> wrote:
> Nope, on cell.
> On Dec 24, 2010 1:02 PM, "Satheesh Kannan A B" <satheesh.kan...@hcl.com>
> wrote:
>> Hi,
>>
>> Can u please give an example for below of my code
>>
>> Thanks and Regards,
>>
>> Satheesh Kannan A B
>>
>>
>>
>> -----Original Message-----
>> From: Dave Newton [mailto:davelnew...@gmail.com]
>> Sent: Friday, December 24, 2010 11:25 PM
>> To: Struts Users Mailing List
>> Subject: Re: FW: Iterator: field errors.
>>
>> You can if they're indexed, no?
>> On Dec 24, 2010 12:53 PM, "Satheesh Kannan A B" <satheesh.kan...@hcl.com>
>> wrote:
>>> Hi,
>>>
>>> Still now I didn't get any solution for this. I think in struts 2.*
> server
>> side validation is not good as struts 1.*.
>>> Since i cant display exact fielderror message for a field in a iterator
>> and also once I submit I cant get the list object again.( list object ill
>> get from data layer, its not static to use prepare method).
>>>
>>>
>>> Thanks and Regards,
>>>
>>> Satheesh Kannan A B
>>>
>>>
>>> -----Original Message-----
>>> From: Satheesh Kannan A B
>>> Sent: Friday, December 10, 2010 3:14 PM
>>> To: Struts Users Mailing List (user@struts.apache.org)
>>> Subject: Re: Iterator: field errors.
>>>
>>>
>>> Hi,
>>> Generic I have given a pojo class List<PojoClassBO> and am doing
>> validation as a separate method in my action as given below.
>>> List<PojoClassBO> boList = new ArrayList< PojoClassBO >();
>>>
>>> Public String save(){
>>>
>>> If(isValid())
>>> {
>>> Continue....
>>> }else{
>>> Return "input";
>>> }
>>>
>>> Return "success";
>>> }
>>>
>>> Private Boolean isValid(){
>>> if(String.isEmpty()){
>>> addFieldError("bo.FieldName",getText("error.code"));
>>> }
>>>
>>> if (getFieldErrors().size() > 0) {
>>> return true;
>>> } else{
>>> Return false;
>>> }
>>> }
>>>
>>>
>>>
>>> Thanks and Regards,
>>>
>>> Satheesh Kannan A B
>>>
>>>
>>> -----Original Message-----
>>> From: Li Ying [mailto:liying.cn.2...@gmail.com]
>>> Sent: Friday, December 10, 2010 5:35 AM
>>> To: Struts Users Mailing List
>>> Subject: Re: Iterator: field errors.
>>>
>>> What is the data type of objectList?
>>>
>>> How did you execute the validation, and how did you add the field error?
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>
>>> Hi,
>>>
>>> I have a requirement like, am iterating a list of values and populating
> in
>> a text box. It may be more than 5 rows. I need to validate whether it's
an
>> integer and want to display error message below the field. For a normal
>> field with a unique I have done it well. But I don't know how to do for
> list
>> if validation fails. Since after validation fails the iterator grid also
>> empty and am not able to display field values.
>>> <s:iterator values="objectList">
>>> <s:textfield name="bo.name" />
>>> <s:fielderror name="bo.name" ></s:fielderror>
>>> </s:iterator>
>>> Please suggest me how to populate grid values in jsp if validation fails
>> and also validation messages below field of each row.
>>>
>>>
>>>
>>> Thanks and Regards,
>>>
>>> Satheesh Kannan A B
>>>
>>> ::DISCLAIMER::
>>>
>>
>
-----------------------------------------------------------------------------------------------------------------------
>>>
>>> The contents of this e-mail and any attachment(s) are confidential and
>> intended for the named recipient(s) only.
>>> It shall not attach any liability on the originator or HCL or its
>> affiliates. Any views or opinions presented in
>>> this email are solely those of the author and may not necessarily
reflect
>> the opinions of HCL or its affiliates.
>>> Any form of reproduction, dissemination, copying, disclosure,
>> modification, distribution and / or publication of
>>> this message without the prior written consent of the author of this
>> e-mail is strictly prohibited. If you have
>>> received this email in error please delete it and notify the sender
>> immediately. Before opening any mail and
>>> attachments please check them for viruses and defect.
>>>
>>>
>>
>
-----------------------------------------------------------------------------------------------------------------------
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>

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

Reply via email to