OFBiz认为一些键名为反馈消息的占位符。
进入ScreenRenderer的populateContextForRequest方法可以看到
// setup message lists
List<String> eventMessageList = UtilGenerics.toList(request.getAttribute("eventMessageList"));
if (eventMessageList == null) eventMessageList = FastList.newInstance();
List<String> errorMessageList = UtilGenerics.toList(request.getAttribute("errorMessageList"));
if (errorMessageList == null) errorMessageList = FastList.newInstance();
if (request.getAttribute("_EVENT_MESSAGE_") != null) {
eventMessageList.add(UtilFormatOut.replaceString((String) request.getAttribute("_EVENT_MESSAGE_"), "\n", "<br/>"));
request.removeAttribute("_EVENT_MESSAGE_");
}
List<String> msgList = UtilGenerics.toList(request.getAttribute("_EVENT_MESSAGE_LIST_"));
if (msgList != null) {
eventMessageList.addAll(msgList);
request.removeAttribute("_EVENT_MESSAGE_LIST_");
}
if (request.getAttribute("_ERROR_MESSAGE_") != null) {
errorMessageList.add(UtilFormatOut.replaceString((String) request.getAttribute("_ERROR_MESSAGE_"), "\n", "<br/>"));
request.removeAttribute("_ERROR_MESSAGE_");
}
if (session.getAttribute("_ERROR_MESSAGE_") != null) {
errorMessageList.add(UtilFormatOut.replaceString((String) session.getAttribute("_ERROR_MESSAGE_"), "\n", "<br/>"));
session.removeAttribute("_ERROR_MESSAGE_");
}
msgList = UtilGenerics.toList(request.getAttribute("_ERROR_MESSAGE_LIST_"));
if (msgList != null) {
errorMessageList.addAll(msgList);
request.removeAttribute("_ERROR_MESSAGE_LIST_");
}
context.put("eventMessageList", eventMessageList);
context.put("errorMessageList", errorMessageList);
if (request.getAttribute("serviceValidationException") != null) {
context.put("serviceValidationException", request.getAttribute("serviceValidationException"));
request.removeAttribute("serviceValidationException");
}
可以看出来request的Attributes中的占位符主要是
eventMessageList(一个list)
errorMessageList(一个list)
_EVENT_MESSAGE_ (String)
_EVENT_MESSAGE_LIST_ (List)
_ERROR_MESSAGE_ (String)
_ERROR_MESSAGE_LIST_ (String)
serviceValidationException
session中的Attributes中的占位符主要是
_ERROR_MESSAGE_
其中eventMessageList被添加到eventMessageList
errorMessageList被添加到errorMessageList
_EVENT_MESSAGE_ eventMessageList
_EVENT_MESSAGE_LIST_ eventMessageList
_ERROR_MESSAGE_ errorMessageList
_ERROR_MESSAGE_(session) errorMessageList
_ERROR_MESSAGE_LIST_ errorMessageList
最后是将
context.put("eventMessageList", eventMessageList);
context.put("errorMessageList", errorMessageList);
因此在context能访问到eventMessageList和errorMessageList
进入ScreenRenderer的populateContextForRequest方法可以看到
// setup message lists
List<String> eventMessageList = UtilGenerics.toList(request.getAttribute("eventMessageList"));
if (eventMessageList == null) eventMessageList = FastList.newInstance();
List<String> errorMessageList = UtilGenerics.toList(request.getAttribute("errorMessageList"));
if (errorMessageList == null) errorMessageList = FastList.newInstance();
if (request.getAttribute("_EVENT_MESSAGE_") != null) {
eventMessageList.add(UtilFormatOut.replaceString((String) request.getAttribute("_EVENT_MESSAGE_"), "\n", "<br/>"));
request.removeAttribute("_EVENT_MESSAGE_");
}
List<String> msgList = UtilGenerics.toList(request.getAttribute("_EVENT_MESSAGE_LIST_"));
if (msgList != null) {
eventMessageList.addAll(msgList);
request.removeAttribute("_EVENT_MESSAGE_LIST_");
}
if (request.getAttribute("_ERROR_MESSAGE_") != null) {
errorMessageList.add(UtilFormatOut.replaceString((String) request.getAttribute("_ERROR_MESSAGE_"), "\n", "<br/>"));
request.removeAttribute("_ERROR_MESSAGE_");
}
if (session.getAttribute("_ERROR_MESSAGE_") != null) {
errorMessageList.add(UtilFormatOut.replaceString((String) session.getAttribute("_ERROR_MESSAGE_"), "\n", "<br/>"));
session.removeAttribute("_ERROR_MESSAGE_");
}
msgList = UtilGenerics.toList(request.getAttribute("_ERROR_MESSAGE_LIST_"));
if (msgList != null) {
errorMessageList.addAll(msgList);
request.removeAttribute("_ERROR_MESSAGE_LIST_");
}
context.put("eventMessageList", eventMessageList);
context.put("errorMessageList", errorMessageList);
if (request.getAttribute("serviceValidationException") != null) {
context.put("serviceValidationException", request.getAttribute("serviceValidationException"));
request.removeAttribute("serviceValidationException");
}
可以看出来request的Attributes中的占位符主要是
eventMessageList(一个list)
errorMessageList(一个list)
_EVENT_MESSAGE_ (String)
_EVENT_MESSAGE_LIST_ (List)
_ERROR_MESSAGE_ (String)
_ERROR_MESSAGE_LIST_ (String)
serviceValidationException
session中的Attributes中的占位符主要是
_ERROR_MESSAGE_
其中eventMessageList被添加到eventMessageList
errorMessageList被添加到errorMessageList
_EVENT_MESSAGE_ eventMessageList
_EVENT_MESSAGE_LIST_ eventMessageList
_ERROR_MESSAGE_ errorMessageList
_ERROR_MESSAGE_(session) errorMessageList
_ERROR_MESSAGE_LIST_ errorMessageList
最后是将
context.put("eventMessageList", eventMessageList);
context.put("errorMessageList", errorMessageList);
因此在context能访问到eventMessageList和errorMessageList