Package com.opensymphony.xwork2

Examples of com.opensymphony.xwork2.Action


        if (error instanceof ActionError)
            actionError = ((ActionError)error);
        else
            actionError = new ActionError(error);
        // put Error on session
        ActionContext context = ActionContext.getContext();
        context.getSession().put(LAST_ACTION_ERROR_ATTRIBUTE, actionError);
    }
View Full Code Here


    /*
     * @see org.apache.empire.struts2.action.ActionErrorProvider#getLastActionMessage(boolean)
     */
    public String getLastActionMessage(boolean clear)
    {
        ActionContext context = ActionContext.getContext();
        Object msg = context.getSession().get(LAST_ACTION_MESSAGE_ATTRIBUTE);
        if (clear)
            context.getSession().remove(LAST_ACTION_MESSAGE_ATTRIBUTE);
        return StringUtils.toString(msg);
    }
View Full Code Here

   
    protected void setActionMessage(String message)
    {   // put Message on session
        if (message.startsWith("!"))
            message = getText(message.substring(1));
        ActionContext context = ActionContext.getContext();
        context.getSession().put(LAST_ACTION_MESSAGE_ATTRIBUTE, message);
    }
View Full Code Here

   
    // ------- Request Param accessors -------
   
    public final Map getRequestParameters()
    {
        ActionContext context = ActionContext.getContext();
        return (context!=null) ? context.getParameters() : null;
    }
View Full Code Here

    }
   
    protected Object getActionObject(String name)
    {
        // Get the object key
        ActionContext context = ActionContext.getContext();
        String key = getActionObjectName(context, name);
        if (key==null)
            return null;
        // Get the object from the session
        return context.getSession().get(key);
    }
View Full Code Here

        return context.getSession().get(key);
    }
   
    protected void putActionObject(String name, Object item)
    {   // Put object
        ActionContext context = ActionContext.getContext();
        String key = getActionObjectName(context, name);
        if (key!=null)
            context.getSession().put(key, item);
    }
View Full Code Here

            context.getSession().put(key, item);
    }
   
    protected void removeActionObject(String name)
    {   // Clear object
        ActionContext context = ActionContext.getContext();
        String key = getActionObjectName(context, name);
        if (key!=null)
            context.getSession().remove(key);
    }
View Full Code Here

    public Object getActionBean(Class objClass, boolean create, String ownerProperty)
    {
        if (objClass==null)
            return null;
        // get the object key
        ActionContext context = ActionContext.getContext();
        String key = getActionBeanName(context, objClass, ownerProperty);
        if (key==null)
            return null;
        // get the object from the session
        Object obj = context.getSession().get(key);
        if (obj==null && create)
        {   try {
                obj = objClass.newInstance();
                context.getSession().put(key, obj);
            } catch(Exception e) {
                log.fatal("Cannot create Instance of type " + objClass.getName(), e);
            }
        }
        return obj;
View Full Code Here

        {   // Error
            log.error("Unable to store object on session. Object is null, a primitive type or a string!");
            return;
        }   
        // Put object
        ActionContext context = ActionContext.getContext();
        String key = getActionBeanName(context, obj.getClass(), ownerProperty);
        if (key!=null)
            context.getSession().put(key, obj);
    }
View Full Code Here

   
    public void removeActionBean(Class objClass, String propertyName)
    {
        if (objClass==null)
            return;
        ActionContext context = ActionContext.getContext();
        String key = getActionBeanName(context, objClass, propertyName);
        if (key!=null)
            context.getSession().remove(key);
    }
View Full Code Here

TOP

Related Classes of com.opensymphony.xwork2.Action

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.