what is the benefit from using xml files in server side validation, in struts, fo开发者_如何学编程r example, XML files are used in validation, here's an example http://www.vaannila.com/struts-2/struts-2-example/struts-2-validation-using-xml-example-1.html, and other practise to put all forms specification into XML file and parse it once then cashe the resulted object in order to use it in another time without the need to parse XML file again "the concept of lazy initialization". I want to know why using XML??
1) It's a file that can be configured easily without recompiling the application much the same as an app.config file
2) Advantage over app.config is that this validation file is specific to a single task, reducing the risk that would be incurred if the main app.config was edited and updated.
So basically you can now if you like put a GUI editor in front of the xml file and provide a means for administrators to modify the contents in a live environment.
Storing the data in a database would give you similar benefits, but it's a rather heavy weight solution to the problem.
精彩评论