• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Validation of List property in a Form

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

(1) I am having a form that contains a variable called 'listItem', which is in turn , a variable of type 'java.util.List'.
(2) listItem contains objects of type 'UserInfo'. UserInfo contains two attributes name & city (both Strings)
(3) As part of validation, I have the following
<form name="userInfoForm">
<field property="listItem.name" depends="maxlength,mask" >
<msg name="mask" key="userInfoForm.name.display_msg"/>
<arg0 key="userInfoForm.name.display_name"/>
<var>
<var-name>mask</var-name>
<var-value>^[\w]*$</var-value>
</var>
<arg1 name="maxlength" key="${var:maxlength}" resource="false"/>
<var>
<var-name>maxlength</var-name>
<var-value>25</var-value>
</var>
</field>

<field property="listItem.city" depends="maxlength,mask" >
<msg name="mask" key="userInfoForm.city.display_msg"/>
<arg0 key="userInfoForm.city.display_name"/>
<var>
<var-name>mask</var-name>
<var-value>^[\w]*$</var-value>
</var>
<arg1 name="maxlength" key="${var:maxlength}" resource="false"/>
<var>
<var-name>maxlength</var-name>
<var-value>25</var-value>
</var>
</field>
</form>

(4) I have the required setup for displaying errors
(5) The form, 'UserInfoForm' extends 'ValidatorForm'
(6) I have the required setup in struts-config.xml

The problem is struts does not validate the fields even if it is wrong/invalid. How do I fix that? Is there anything that I am missing?
Please HELPPP!

Thanks
Dhan Raj
 
Let me tell you a story about a man named Jed. He made this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic