Okay. It looks like struts2 does not have collection validation. Does anyone know how to add it manually from Xworks? This is not posted on the struts2 site at all. It should be posted to a FAQ.
This is my workaround? <validator type="expression"> <param name="expression"> workspaces.{#this.name.length() > 0}.{? #this == false }.size() <= 0 </param> <message key="workspace.name.required" /> </validator> Steve On Thu, Feb 4, 2010 at 8:19 PM, Stephen Ince <stephenpi...@gmail.com> wrote: > Okay. It looks what I want is a collection validator but it does not > seem to work with struts2. > Question. > Does anyone know if the Xwork collection validator is bundled with > struts2. I tried the following but it failed. > > <field name="workspaces" > > <field-validator type="collection"> > <param name="property">workspaces.name</param> > > Steve > > On Thu, Feb 4, 2010 at 6:34 PM, Stephen Ince <stephenpi...@gmail.com> wrote: >> Okay. In struts 1 they have an indexedListProperty attribute. >> Question. >> Does struts2 validation work for indexed lists? . I looked at the >> dtd and could not find it. I tried the following but it failed. >> >> <field name="name" indexedListProperty="workspaces" > >> <field-validator type="required"> >> >> Is it possible to use the struts1 validation frame works with struts2. >> >> Steve >> >> >> On Thu, Feb 4, 2010 at 7:45 AM, Stephen Ince <stephenpi...@gmail.com> wrote: >>> I am using struts 2 and I am trying to use the validation framework. I >>> am having difficulty trying to validate a list. >>> >>> e.g >>> workspaces[0].name >>> workspaces[1].name >>> workspaces[2].name >>> workspaces[3].name >>> workspaces[4].name >>> workspaces[5].name >>> >>> I would like to require name. >>> I have tried the following but it does not seem to work. >>> >>> <field name="workspaces.name"> >>> <field-validator type="required"> >>> >>> <field name="workspaces[].name"> >>> <field-validator type="required"> >>> >>> >>> Any help would be appreciated. >>> >>> Steve >>> >> > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org