? errors ? = ? new ? ActionErrors(); ? ?
? errors.add("isExist", ? new ? ActionError("error.isExist"));???
// errors.add("isExist", ? new ? ActionError("error.isExist"));???等效于errors.add("isExist", ? new ? ActionMessage("error.isExist"));????
? saveErrors(request, ? errors); ?
? return ? (mapping.findForward("failure"));???
failure頁面里也定義了<html:errors?? name="isExist"/> ?
? ApplicationResources.properties里面也定義了error.isExist=user ? have ? already ? exist!!!???
? 運行結果 跳轉到failure頁面,顯示“user ? have ? already ? exist!!!???”
ActionErrors.GLOBAL_ERROR
怎么理解
它和我們使用普通的字符有什么區別啊
部分代碼如下:
err.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.logon"));
err.add("errinfo", new ActionError("error.logon"));
以上兩名有什么區別啊
沒什么區別
ActionErrors.GLOBAL_ERROR也是一個字符串。 最好寫做ActionErrors.GLOBAL_ERROR
不然的話可能會報錯。