Hi Wade,

The problem is because you're using indexed properties. When you have property names like 'names[0]' Stripes does validation a little differently. It assumes each index (e.g. 0) is a "row" in a form and only applies validation if at least one value in a row is entered.

The easy fix in your case is to just change your property names in the JSP to "names". Stripes will then take all the values submitted and set them as a list of Strings in your ActionBean.

-t


On Feb 17, 2009, at 12:03 AM, Wade Marshall wrote:

Hi all,

I have an action bean with a property that has a List of Strings....

public SampleActionBean extends implements ActionBean {

   private List<String> names;

   public List<String> getNames() { return names; }

   @Validate(required=true)
public void setNames(List<String> names) { return this.names = names; }

}


...and jsp that allows the user to edit them...


<stripes:form action="/Sample.action">
   <c:forEach items="${pixlist}" var="pix" varStatus="loop">
<stripes:text name="names[${loop.index}]" size="20" class="entry"></stripes:text>
   </c:forEach>
</stripes:form>


However, if I leave any (or all) fields blank......no validation errors occur. The binding works fine though.

Why doesn't the validation trigger ?

Thanks,
Wade.
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to