Getting null value of a field while working with struts2 validation through .xml file
This is a small post to provide the solution to a problem of getting a null value of a field while working with struts2 validation through .xml file.
Validation content that is entered by the user through .xml file is one of a way for validating fields in a struts2 framework.
For this, you have to make a file with extension .xml with the special name. i.e
Where “class_name” is the name of the class that contains variables that are going to be validated and then add specified coding for validation of the variables in .xml file.
One most important thing that should be kept in mind while validation by this method, the class that contains variable should also contain the getter/setter of those variables in the same class. If you do not write getter/setter or there is any mismatch in the filed name and getter /setter then you always get a null value even if you write a value in the field in your jsp page.