閱讀290 返回首頁    go 阿裏雲 go 技術社區[雲棲]


webwork框架action工具類

package com.aspboy.base.action;

import java.util.Collection;

import com.opensymphony.xwork.Action;
import com.opensymphony.xwork.ActionContext;
import com.opensymphony.xwork.ActionInvocation;
import com.opensymphony.xwork.ValidationAware;

/**
 * @deprecated Class ActionUtils is deprecated
 */

public class ActionUtils {

 private ActionUtils() {
 }

 public static Action getAction() {
  if (ActionContext.getContext().getValueStack().peek() instanceof Action)
   return (Action) ActionContext.getContext().getValueStack().peek();
  ActionInvocation ai = ActionContext.getContext().getActionInvocation();
  if (ai != null)
   return (Action) ai.getAction();
  else
   return null;
 }

 public static Collection getActionMessages() {
  Action a = getAction();
  if (a != null && (a instanceof ValidationAware))
   return ((ValidationAware) a).getActionMessages();
  else
   return null;
 }
}

最後更新:2017-04-02 03:13:28

  上一篇:go 關於字符串==和equals的區別 ==對象相同 equals對象內容相同
  下一篇:go jdbc數據庫連接管理封裝工具類,不同使用屬性文件配置數據庫連接信息(3)