Using Validation.xml for Action Form that contains object Type?

Discussions

Web tier: servlets, JSP, Web frameworks: Using Validation.xml for Action Form that contains object Type?

  1. Category :Struts (Validation)
    -------------------------------

    My action form just contains one attribute of type Profile. Profile has an attribute address that is of type Address. If i want to validate City, how do I do it using validation.xml file. If I use . (dot) to navigate from profile to Address, property attribute wont recognize it. I strictly want to use validation.xml file to do that.
    -----------------------------------------------------
    public final class profileForm extends ActionForm{

    private Profile profile;

    }

    public class Profile {

    name String
    phoneNumber String
    address Address

    }


    public class Address {

    Street String;
    City String;
    State String;
    Zip String;

    }

    This code is not working for me.
    -----------------------------------------------------------
    <form name="profileForm">
    <field property="address.city" depends="required">
    <arg key="profileForm.address.city" position="0"/>
    </field>
    </form>
    -----------------------------------------------------------

    Threaded Messages (1)

  2. little correction[ Go to top ]

    there is a silly mistake in the code. I put the attribute name first and type after that. ignore that part.