📄 actionutils.java
字号:
package com.laoer.blog.web.action;
import javax.servlet.http.*;
import org.apache.struts.action.*;
import org.apache.struts.*;
/**
* <p>Title: 天乙博客</p>
*
* <p>Description: 天乙博客系统</p>
*
* <p>Copyright: Copyright (c) 2005</p>
*
* <p>Company: Laoer.com</p>
*
* @author laoer[Gong Tianyi]
* @version 1.0
*/
public class ActionUtils {
public ActionUtils() {
}
public synchronized static void addErrors(HttpServletRequest request, ActionMessages errors) {
if (errors == null) {
// bad programmer! *slap*
return;
}
// get any existing errors from the request, or make a new one
ActionMessages requestErrors = (ActionMessages) request.getAttribute(Globals.ERROR_KEY);
if (requestErrors == null) {
requestErrors = new ActionMessages();
}
// add incoming errors
requestErrors.add(errors);
// if still empty, just wipe it out from the request
if (requestErrors.isEmpty()) {
request.removeAttribute(Globals.ERROR_KEY);
return;
}
// Save the errors
request.setAttribute(Globals.ERROR_KEY, requestErrors);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -