Details
Description
in http://www.manning-source.com/books/husted/husted_ch12.pdf on p370, Ted
rightfully says that one disadvantage of using the valiator.xml is that there is
now yet another file that needs to be kept synchronized.
With http://sourceforge.net/projects/fmpp and asm-dumpfield as per
http://sourceforge.net/mailarchive/message.php?msg_id=6152001, I was able to
automate this all in a single place (i.e. page markup, the ActionForm, and the
Validator and Struts configuration).
The alignment of SQL field names AND lengths is yet a similar problem.
Were mysqldump working as specified (http://bugs.mysql.com/bug.php?id=1530), my
fmpp could do that too and generate a SQLConst.java file that would prevent my
sql queries suffering from time-consuming field name typos, etc.
Similarly, such sql-schema output could also be used to extract maximum field
lengths and data types for validation.xml. (especially since for example MySQL
is very much in need for maxlength validation - http://lists.mysql.com/java/6889)
Suggestions:
1) as per Ted's chapter, it would be useful to have a "Pro&Con" or "When to best
use the validator" section in dev_validator.html
2) add a ToDo section to the chapter listing the need for a mechanism to easily
align maxlength of SQL and the struts validator (see also
http://bugs.mysql.com/bug.php?id=1307) - or do you already have a solution for that?