在 Apache Struts 1.3.10 中找不到 ActionError 类

nhu*_*uvy 3 struts struts-1

我按照书(2004)中的教程进行操作JakataStruts live。我有代码片段:

@Override
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
ActionErrors errors = new ActionErrors();

if(firstName == null || firstName.trim().equals("")){
    errors.add("firstName", new ActionError("userRegistration.firstName.problem"));
}
//...
return errors;
Run Code Online (Sandbox Code Playgroud)


Netbeans IDE 注意到:“找不到符号”。如何解决上述问题呢?

nhu*_*uvy 6

ActionError已被弃用。使用ActionMessage类别:

errors.add("firstName", new ActionMessage("userRegistration.firstName.problem"));
Run Code Online (Sandbox Code Playgroud)