ActionError无法解析为类型
点击右边红色标题查看本文完整版:ActionError无法解析为类型
errors.add( "username ",new ActionError( "error.name.required ");
在PROPERTIES文件也加了error.name.required=“”
而且也import org.apache.struts.action.ActionErrors;
结果报错说ActionError无法解析为类型。
弄了好半天,哪位给指点下?
------解决方法--------------------
是类库没找到啦
加入
import org.apache.struts.action.ActionMessage;
就可以了
示例
package com.joinbc.struts.form;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
public class LoginForm extends ActionForm {
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
// TODO Auto-generated method stub
ActionErrors errors=new ActionErrors();
if(username.equals( " ")||username.equals( "guest "))
{
errors.add( "username ",new ActionMessage( "mytest.error "));
}
return errors;
}
......................
------解决方法--------------------
import org.apache.struts.action.ActionError is needed.