webwork框架action工具类

webwork2框架action工具类

 

 

package com.yanek.web.mvc.webwork.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;
 }
}

 

 

你可能感兴趣的:(框架,null,Webwork,Class,action,deprecated)