Validation is an important part of many web applications. Input can be validated on the client side or the server side. The Validator framework can be used to simplify input validations on both sides. This tutorial explains how.
Hook the Validator with the Struts framework
The last step is to configure the struts-config.xml so that the Struts framework can communicate with the Validator framework. This is done using the plugin tag of struts-config.xml. First declare the plug-in using the <plugin> tag. The className attribute is used to specify the class implementing the plug-in functionality. Since the Validator framework has to be used the className has the value “org.apache.struts.validator.ValidatorPlugIn”
The value of the property is pathnames and the value of value is the path where the XML files are kept. Now the application is ready to be used.
This brings us to the end of the first part of the Validator framework tutorial. So what are other features provided by this framework and how can they be utilized to reduce development time? I will give details in the next part. Till next time.
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.