使用validator包括如下三步:1、启用validator插件;2、生成form bean类;3、修改配置文件。下面将详细说明如何配置和使用validator。
一、启用validator插件
虽然在struts工具包中包含了validator,但默认情况下validator是没有被启用的。若要启用validator,必须在struts-config.xml文件中添加入下的代码:
<!-- validator configuration -->
<plug-in classname="org.apache.struts.validator.validatorplugin">