May I didn't explain myself correctly. What I would like to know is how to 
validate multiple fields.  I'll write an example. I have a form in a JSP which 
generate the field dynamically. E.g: 

<s:form action="editPerson" theme="simple" validate="false">
    <table>
        <tr>
            <th>ID</th>
            <th>First Name</th>
            <th>Last Name</th>
        </tr>
        <s:iterator id="p" value="persons">
            <tr>
                <td>
                    <s:property value="%{id}" />
                </td>
                <td>
                    <s:textfield label="First Name" name="persons(%{id}).name" 
value="%{name}" theme="simple" />
                </td>
                <td>
                    <s:textfield label="Last Name" 
name="persons(%{id}).lastName" value="%{lastName}" theme="simple"/>
                </td>
            </tr>
        </s:iterator>
    </table>

    <s:submit method="save" value="Save all persons"/>
</s:form>



Where person is a List in the action class. Now, what I would like to know is 
how could I achieve this fields to be validated. For example, I would like that 
if the name is filled the last name should be also filled and both can only 
contains letters and blanks. 

Well, I don't want you to give me the complete solution ( the expresion or reg 
expresion), just want to know how I can refer all these fields from the 
MyActionClass-validation.xml. 

Hope I've explained better than in the first post.

Please, help me.

Thanks in advance.


----- Mensaje original ----
De: Julio Alberto Jalón <[EMAIL PROTECTED]>
Para: user@struts.apache.org
Enviado: miércoles, 15 de octubre, 2008 12:32:05
Asunto: Struts2 Collection validation


I'm learning struts2 through the struts2-showcase application example. From the 
"Person Manager" functionality I've learned how to send multiples values from 
client to server using collections to manage these values, but now I'd like to 
know how to validate these values using struts2 validation. I don't know what 
to put in *-validation.xml in order to validate these values. Should I use 
custom validation?

Thanks in advance.


      

Reply via email to