Meaningless Drivel is fun!*
The moose likes Struts and the fly likes Error in Validation XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Error in Validation XML" Watch "Error in Validation XML" New topic
Author

Error in Validation XML

Atul bvdu
Greenhorn

Joined: Oct 02, 2012
Posts: 2
HI All
I am new in struts 2. So sorry if my question is silly.
I am trying to apply validation of the field.
my action class is like this.

com.test.mypackage;
public class UserRegistration extends ActionSupport{
private UserAddressBean useraddressObject;
... setter/getter
}

UserAddressBean clas is like this

com.test.mypackage;
public class UserAddressBean {
Private String addressLine1;
... setter/getter
}

now I am cteating UserRegistration-validation.xml as follows

1. <!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.3//EN"
2. "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
3. <validators>
4. <field name="usermasterbeanObject.userlogin" >
5. <field-validator type="requiredstring"></field-validator>
6. <message>Enter Login Address.</message>
7. </field>
8.</validators>

I am creating this XML under com.test.mypackage folder
Now the problem is
In eclipse it is showing following errors in the XML
a) On line no 4. The content of element type "field" must match "(field-validator)+".
b) On line no 5. The content of element type "field-validator" is incomplete, it must match "(param*,message)".


Please help me to solve the errors.

Thanks

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18662
    
    8

If the field-validator element is supposed to contain the message element, then the field-validator element's closing tag should be after the message element, not before it.
Atul bvdu
Greenhorn

Joined: Oct 02, 2012
Posts: 2
Paul Clapham wrote:If the field-validator element is supposed to contain the message element, then the field-validator element's closing tag should be after the message element, not before it.


Thanks Paul. It worked. Was my mistake. Putted the tags incorrectly.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error in Validation XML