? 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頁(yè)面里也定義了<html:errors?? name="isExist"/> ?
? ApplicationResources.properties里面也定義了error.isExist=user ? have ? already ? exist!!!???
? 運(yùn)行結(jié)果 跳轉(zhuǎn)到failure頁(yè)面,顯示“user ? have ? already ? exist!!!???”
ActionErrors.GLOBAL_ERROR
怎么理解
它和我們使用普通的字符有什么區(qū)別啊
部分代碼如下:
err.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.logon"));
err.add("errinfo", new ActionError("error.logon"));
以上兩名有什么區(qū)別啊
沒什么區(qū)別
ActionErrors.GLOBAL_ERROR也是一個(gè)字符串。 最好寫做ActionErrors.GLOBAL_ERROR
不然的話可能會(huì)報(bào)錯(cuò)。