今天做基于AJAX的校验的练习时,遇到了如下的exception:
2011-5-11 11:18:08 uk.ltd.getahead.dwr.util.CommonsLoggingOutput warn
警告: Error setting class=org.apache.Struts2.validators.DWRValidator on uk.ltd.getahead.dwr.create.NewCreator
java.lang.IllegalArgumentException: Class not found: org.apache.Struts2.validators.DWRValidator
在网上找了很多的方法, 并且尝试了这些方法, 但都没效, 后来发现是dwr.xml文件内的"Struts2"这个词的大小写的问题:
错误配置:
<dwr>
<allow>
<create creator="new" javascript="validator">
<param name="class" value="org.apache.Struts2.validators.DWRValidator"/>
</create>
<convert converter="bean" match="com.opensymphony.xwork2.ValidationAwareSupport"/>
</allow>
<signatures>
<![CDATA[import java.util.Map;
import org.apache.Struts2.validators.DWRValidator;
DWRValidator.doPost(String,String,Map<String,String>);]]>
</signatures>
</dwr>
将上面的蓝色的"Struts2"改为"struts2",我就解决了该exceptiion, 真是粗心大意啊!