第二十四部分: 这是一个简单的 log4j 配置方法,只是在后台打印出需要的数据。如果还有别的需求,
为了达到页面验证的目的,我们还需要使用到 struts 的验证框架。
在 struts-validator 中添加 validation.xml 。在这配置验证规则:
<! DOCTYPE form-validation PUBLIC "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN" "http://jakarta.apache.org/commons/dtds/validator_1_0.dtd" > < form-validation > < formset > < form name ="productsForm" > < field property ="gameNameCn" depends ="required" > < arg0 key ="errors.gameNameCn" /> </ field > < field property ="gameNameEn" depends ="required" > < arg0 key ="errors.gameNameEn" /> </ field > < field property ="gameCapacity" depends ="integer" > < arg0 key ="errors.gameCapacity" /> </ field > < field property ="gamePrice" depends ="float" > < arg0 key ="errors.gamePrice" /> </ field > </ form > </ formset >