version : xwork-2.1.0
/*
* Copyright (c) 2002-2006 by OpenSymphony
* All rights reserved.
*/
package com.opensymphony.xwork2; import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle; import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory; /**
* Provides a default implementation for the most common actions.
* See the documentation for all the interfaces this class implements for more detailed information.
*/
public class ActionSupport implements Action, Validateable, ValidationAware, TextProvider, LocaleProvider, Serializable { protected static Logger LOG = LoggerFactory.getLogger(ActionSupport.class); private final transient TextProvider textProvider = new TextProviderFactory().createInstance(getClass(), this);
private final ValidationAwareSupport validationAware = new ValidationAwareSupport(); public void setActionErrors(Collection errorMessages) {
validationAware.setActionErrors(errorMessages);
} public Collection getActionErrors() {
return validationAware.getActionErrors();
} public void setActionMessages(Collection messages) {
validationAware.setActionMessages(messages);
} public Collection getActionMessages() {
return validationAware.getActionMessages();
} /**
* @deprecated Use {@link #getActionErrors()}.
*/
public Collection getErrorMessages() {
return getActionErrors();
} /**
* @deprecated Use {@link #getFieldErrors()}.
*/
public Map getErrors() {
return getFieldErrors();
} public void setFieldErrors(Map errorMap) {
validationAware.setFieldErrors(errorMap);
} public Map getFieldErrors() {
return validationAware.getFieldErrors();
} public Locale getLocale() {
ActionContext ctx = ActionContext.getContext();
if (ctx != null) {
return ctx.getLocale();
} else {
LOG.debug("Action context not initialized");
return null;
}
} public String getText(String aTextName) {
return textProvider.getText(aTextName);
} public String getText(String aTextName, String defaultValue) {
return textProvider.getText(aTextName, defaultValue);
} public String getText(String aTextName, String defaultValue, String obj) {
return textProvider.getText(aTextName, defaultValue, obj);
} public String getText(String aTextName, List args) {
return textProvider.getText(aTextName, args);
} public String getText(String key, String[] args) {
return textProvider.getText(key, args);
} public String getText(String aTextName, String defaultValue, List args) {
return textProvider.getText(aTextName, defaultValue, args);
} public String getText(String key, String defaultValue, String[] args) {
return textProvider.getText(key, defaultValue, args);
} public String getText(String key, String defaultValue, List args, ValueStack stack) {
return textProvider.getText(key, defaultValue, args, stack);
} public String getText(String key, String defaultValue, String[] args, ValueStack stack) {
return textProvider.getText(key, defaultValue, args, stack);
} public ResourceBundle getTexts() {
return textProvider.getTexts();
} public ResourceBundle getTexts(String aBundleName) {
return textProvider.getTexts(aBundleName);
} public void addActionError(String anErrorMessage) {
validationAware.addActionError(anErrorMessage);
} public void addActionMessage(String aMessage) {
validationAware.addActionMessage(aMessage);
} public void addFieldError(String fieldName, String errorMessage) {
validationAware.addFieldError(fieldName, errorMessage);
} public String input() throws Exception {
return INPUT;
} public String doDefault() throws Exception {
return SUCCESS;
} /**
* A default implementation that does nothing an returns "success".
* <p/>
* Subclasses should override this method to provide their business logic.
* <p/>
* See also {@link com.opensymphony.xwork2.Action#execute()}.
*
* @return returns {@link #SUCCESS}
* @throws Exception can be thrown by subclasses.
*/
public String execute() throws Exception {
return SUCCESS;
} public boolean hasActionErrors() {
return validationAware.hasActionErrors();
} public boolean hasActionMessages() {
return validationAware.hasActionMessages();
} public boolean hasErrors() {
return validationAware.hasErrors();
} public boolean hasFieldErrors() {
return validationAware.hasFieldErrors();
} /**
* Clears field errors. Useful for Continuations and other situations
* where you might want to clear parts of the state on the same action.
*/
public void clearFieldErrors() {
validationAware.clearFieldErrors();
} /**
* Clears action errors. Useful for Continuations and other situations
* where you might want to clear parts of the state on the same action.
*/
public void clearActionErrors() {
validationAware.clearActionErrors();
} /**
* Clears messages. Useful for Continuations and other situations
* where you might want to clear parts of the state on the same action.
*/
public void clearMessages() {
validationAware.clearMessages();
} /**
* Clears all errors. Useful for Continuations and other situations
* where you might want to clear parts of the state on the same action.
*/
public void clearErrors() {
validationAware.clearErrors();
} /**
* Clears all errors and messages. Useful for Continuations and other situations
* where you might want to clear parts of the state on the same action.
*/
public void clearErrorsAndMessages() {
validationAware.clearErrorsAndMessages();
} /**
* A default implementation that validates nothing.
* Subclasses should override this method to provide validations.
*/
public void validate() {
} public Object clone() throws CloneNotSupportedException {
return super.clone();
} /**
* <!-- START SNIPPET: pause-method -->
* Stops the action invocation immediately (by throwing a PauseException) and causes the action invocation to return
* the specified result, such as {@link #SUCCESS}, {@link #INPUT}, etc.
* <p/>
*
* The next time this action is invoked (and using the same continuation ID), the method will resume immediately
* after where this method was called, with the entire call stack in the execute method restored.
* <p/>
*
* Note: this method can <b>only</b> be called within the {@link #execute()} method.
* <!-- END SNIPPET: pause-method -->
*
* @param result the result to return - the same type of return value in the {@link #execute()} method.
*/
public void pause(String result) {
} }

com.opensymphony.xwork2.ActionSupport类源码的更多相关文章

  1. Java集合---Array类源码解析

    Java集合---Array类源码解析              ---转自:牛奶.不加糖 一.Arrays.sort()数组排序 Java Arrays中提供了对所有类型的排序.其中主要分为Prim ...

  2. Cocos2d-X3.0 刨根问底(六)----- 调度器Scheduler类源码分析

    上一章,我们分析Node类的源码,在Node类里面耦合了一个 Scheduler 类的对象,这章我们就来剖析Cocos2d-x的调度器 Scheduler 类的源码,从源码中去了解它的实现与应用方法. ...

  3. List 接口以及实现类和相关类源码分析

    List 接口以及实现类和相关类源码分析 List接口分析 接口描述 用户可以对列表进行随机的读取(get),插入(add),删除(remove),修改(set),也可批量增加(addAll),删除( ...

  4. Thread类源码剖析

    目录 1.引子 2.JVM线程状态 3.Thread常用方法 4.拓展点 一.引子 说来也有些汗颜,搞了几年java,忽然发现竟然没拜读过java.lang.Thread类源码,这次特地拿出来晒一晒. ...

  5. Java并发编程笔记之Unsafe类和LockSupport类源码分析

    一.Unsafe类的源码分析 JDK的rt.jar包中的Unsafe类提供了硬件级别的原子操作,Unsafe里面的方法都是native方法,通过使用JNI的方式来访问本地C++实现库. rt.jar ...

  6. HTTP Status 500 - com.opensymphony.xwork2.ActionSupport.toAddPage()

    使用struts2过程中碰到以下错误 HTTP Status 500 - com.opensymphony.xwork2.ActionSupport.toAddPage() type Exceptio ...

  7. python附录-builtins.py模块str类源码(含str官方文档链接)

    python附录-builtins.py模块str类源码 str官方文档链接:https://docs.python.org/3/library/stdtypes.html#text-sequence ...

  8. Long类源码浅析

    1.Long类和Integer相类似,都是基本类型的包装类,类中的方法大部分都是类似的: 关于Integer类的浅析可以参看:Integer类源码浅析 2.这里主要介绍一下LongCache类,该缓存 ...

  9. java.lang.Void类源码解析_java - JAVA

    文章来源:嗨学网 敏而好学论坛www.piaodoo.com 欢迎大家相互学习 在一次源码查看ThreadGroup的时候,看到一段代码,为以下: /* * @throws NullPointerEx ...

随机推荐

  1. python 中@property的使用

    从14年下半年开始接触到python,自学了一段时间,后又跟别人学习了下,把基础知识基本上学过了.忽然感觉python不可能这么简单吧,就这么点东西?后来看了下书,发现还有很多的高级部分.连续看了两天 ...

  2. window的cmd窗口运行git

    般情况下,我们在 Window 下安装好 git 后,在运行里面打开 cmd 窗口,在里面直接运行 git --version ,会提示“不是内部或外部命令,也不是一个可运行的程序”. 要想在cmd窗 ...

  3. JPA详解

    2006 年 5 月 2 日,EJB 3.0 规范最终版由 JCP(Java Community Process) 正式公布,标准号为 JSR(Java Specification Request)2 ...

  4. 深入理解Java虚拟机 - 虚拟机内存划分

    在内存管理方面,Java相对于C和C++的区别在于Java具有内存动态分配以及垃圾收集技术,但平时我们很少去关注JVM的内存结构以及GC,在出现内存泄露或溢出方面的问题,排查工作将变得异常艰难.   ...

  5. 【Pure】

    PureA set of small, responsive CSS modules that you can use in every web project.http://purecss.io/

  6. WCF学习笔记(二):简单调用

    转:http://www.cnblogs.com/wengyuli/archive/2009/11/08/1598428.html 一个通信会话过程有两个部分组成,客户端和服务端,他们要进行会话就必然 ...

  7. gitphp日期乱码解决方案

    出现日期乱码的在以下文件中 templates rss tag commitdiffplain log project commit 搜索文件中的 %z 修改为以下代码 {$commit->Ge ...

  8. Win10 查看IE的临时目录

    C:\Users\YOUR_NAME\AppData\Local\Microsoft\Windows\INetCache

  9. NetCat简介与使用方法

    精品学习网考试频道小编应广大考生的需要,特为参加考试的考生策划了“NetCat简介与使用方法”专题等有关资料,供考生参考! 在入侵中它是最经典的工具之一 ,NetCat被所有的网络安全爱好者和研究者称 ...

  10. jdk 1.5新特性说明

    “JDK1.5”的一个重要主题就是通过新增一些特性来简化开发,这些特性包括泛型,for-each循环,自动装包/拆包,枚举,可变参数,静态导入.使用这些特性有助于我们编写更加清晰,精悍,安全的代码. ...