wood burning stoves 2.0*
The moose likes Struts and the fly likes How to use Validation.xml for Action Form that contains object Type ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to use Validation.xml for Action Form that contains object Type ?" Watch "How to use Validation.xml for Action Form that contains object Type ?" New topic
Author

How to use Validation.xml for Action Form that contains object Type ?

Muhammad Faisal
Greenhorn

Joined: Oct 14, 2002
Posts: 11
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 {

String name
String phoneNumber
Address address

}


public class Address {

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

}

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

[ May 24, 2005: Message edited by: Muhammad Faisal ]

[ May 24, 2005: Message edited by: Muhammad Faisal ]
[ May 24, 2005: Message edited by: Muhammad Faisal ]

SCWCD J2EE, OCP(Internet App Dev), SCJP 2
Ryan Dillon
Greenhorn

Joined: May 24, 2005
Posts: 11
Are you saying you have tried profile.address.city and it does not work?
ie:

<form name="profileForm">
<field property="profile.address.city" depends="required">
<arg key="profileForm.address.city" position="0"/>
</field>
</form>

I think this should work as long as the profile bean is not null and the address bean within that is not null.

Regards


Ryan Dillon<br />Code Canvas Technologies<br />RapidJ - Rapid Java Web Development<br /><a href="http://www.codecanvas.com.au/rapidj/" target="_blank" rel="nofollow">http://www.codecanvas.com.au/rapidj/</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to use Validation.xml for Action Form that contains object Type ?
 
Similar Threads
Another "Validator Plugin" Problem
Struts validation not working
validation
StrutsValidation doesn't work messages are not being shown
problem in Struts Validation