• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Using attribute indexedListProperty in field tag in validation.xml

 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ranchers,
Iam using Validator framework, in one of the form,I have a List which contains Lastname,firstname etc, here I need to to validate these fields..

following is the example code....

<form name="XYZForm">
<field property="lastname" depends="required,mask" indexedListProperty="XYZListObject">

Its not working properly,what are the things to do to make it work properly using indexedListProperty...

Thanks in advance.
 
Ramna Reddy
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And I would like to know whether indexedListProperty is supported in struts or not?
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, indexedListProperty is supported in Struts and I have used it successfully. If you specify indexedListProperty="XYZListObject", it is expected that the actual property name for the first element will be "XYZListObject[0].firstName", If that is not the case, the validation will not be performed. Be careful with case. Remember that if your getter is getXYZListObject, the property name used by Struts will be "xYZListObject" not "XYZListObject".
 
Ramna Reddy
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Merrill,

Yes, indexedListProperty is supported in Struts and I have used it successfully. If you specify indexedListProperty="XYZListObject", it is expected that the actual property name for the first element will be "XYZListObject[0].firstName", If that is not the case, the validation will not be performed. Be careful with case. Remember that if your getter is getXYZListObject, the property name used by Struts will be "xYZListObject" not "XYZListObject".

can you please give an example code,or correct this to make it work,this is what iam using in validation.xml...

<form name="IPForm">
<field property="lastname" depends="required,mask" indexedListProperty="pListObject">
<arg0 key="lastname" />
<msg name="mask" key="errors.addpax.LastName.required"/>
<var>
<var-name>mask</var-name>
<var-value>^[a-zA-Z ,]*$</var-value>
</var>
</field>
</form>

Thanks in advance,
RR
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wouldn't be able to tell is your code is correct or not without also seeing your ActionForm bean, the relevant portion of your struts-config.xml file, and the relevant portion of the JSP.

Here is code from a sample page that I have tested and can verify that it works.

struts-config.xml

validation.xml

testRating.jsp
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic