Package org.apache.struts.config

Examples of org.apache.struts.config.ActionConfig


  public void testCreateAction() throws Exception
  {
    ActionCreator actionCreator = newMock(ActionCreator.class);
    CreateAction createAction = getCreateAction(actionCreator);
    ServletActionContext actionContext = getActionContext();
    ActionConfig actionConfig = newMock(ActionConfig.class);
    ModuleConfig moduleConfig = newMock(ModuleConfig.class);
    ActionServlet servlet = newMock(ActionServlet.class);
    Map applicationScope = newMock(Map.class);
    Map actions = new HashMap();
    Action action = new Action();
   
    expect(actionConfig.getModuleConfig()).andReturn(moduleConfig);
    expect(moduleConfig.getPrefix()).andReturn("prefix");
    expect(actionContext.getApplicationScope()).andReturn(applicationScope);
    expect(applicationScope.get("actionsprefix")).andReturn(actions);
    expect(actionCreator.createAction(String.class)).andReturn(action);
    expect(actionContext.getActionServlet()).andReturn(servlet);
View Full Code Here


            /*
             * First get all of the availble action mappings and create all of
             * the forms First try to find the panels action config. Look for
             * the same name as the panel id prefixed by a /
             */
            ActionConfig config = mapping.getModuleConfig().findActionConfig("/" + panel.getId());
            if (null != config && config instanceof ActionMapping) {
                ActionMapping subMapping = (ActionMapping) config;
                SubActionWrapper subActionWrapper = getSubActionWrapper(mapping, form, subMapping, request, index);
                if (null != subActionWrapper)
                    subActions.add(subActionWrapper);
View Full Code Here

     */
    public static ActionForm getActionForm(HttpServletRequest request,
                                           HttpSession session)
    {
        /* Is there a mapping associated with this request? */
        ActionConfig mapping =
            (ActionConfig)request.getAttribute(Globals.MAPPING_KEY);
        if (mapping == null)
        {
            return null;
        }

        /* Is there a form bean associated with this mapping? */
        String attribute = mapping.getAttribute();
        if (attribute == null)
        {
            return null;
        }

        /* Look up the existing form bean */
        if ("request".equals(mapping.getScope()))
        {
            return (ActionForm)request.getAttribute(attribute);
        }
        if (session != null)
        {
View Full Code Here

     */
    public static String getActionFormName(HttpServletRequest request,
                                           HttpSession session)
    {
        /* Is there a mapping associated with this request? */
        ActionConfig mapping =
            (ActionConfig)request.getAttribute(Globals.MAPPING_KEY);
        if (mapping == null)
        {
            return null;
        }

        return mapping.getAttribute();
    }
View Full Code Here

                                       String forward)
    {
        ModuleConfig moduleConfig = ModuleUtils.getInstance().getModuleConfig(request, app);
        //TODO? beware of null module config if ActionServlet isn't init'ed?

        ActionConfig actionConfig =
            (ActionConfig)request.getAttribute(Globals.MAPPING_KEY);

        // NOTE: ActionConfig.findForwardConfig only searches local forwards
        ForwardConfig fc = null;
        if(actionConfig != null)
        {
            fc = actionConfig.findForwardConfig(forward);

            // No ActionConfig forward?
            // Find the ForwardConfig in the global-forwards.
            if(fc == null)
            {
View Full Code Here

        {
            this.xhtml = b.booleanValue();
        }

        /* Is there a mapping associated with this request? */
        ActionConfig config =
                (ActionConfig)request.getAttribute(Globals.MAPPING_KEY);
        if (config != null)
        {
            /* Is there a form bean associated with this mapping? */
            this.formName = config.getAttribute();
        }

        ModuleConfig mconfig = ModuleUtils.getInstance().getModuleConfig(request, app);
        this.resources = (ValidatorResources)app.getAttribute(ValidatorPlugIn.
                VALIDATOR_KEY +
View Full Code Here

        jsFormName = formName;
        if(jsFormName.charAt(0) == '/') {
            String mappingName = StrutsUtils.getActionMappingName(jsFormName);
            ModuleConfig mconfig = ModuleUtils.getInstance().getModuleConfig(request, app);

            ActionConfig mapping = (ActionConfig) mconfig.findActionConfig(mappingName);
            if (mapping == null) {
                throw new NullPointerException("Cannot retrieve mapping for action " + mappingName);
            }
            jsFormName = mapping.getAttribute();
        }

        results.append(getJavascriptBegin(methods));

        for (Iterator i = actions.iterator(); i.hasNext();)
View Full Code Here

            }
            HttpServletRequest req = (HttpServletRequest) request;
            StrutsPortletRenderContext context = new StrutsPortletRenderContext();
            context.setPath(path);
            context.setDispatchNamed(named);
            ActionConfig actionConfig = (ActionConfig) request
                    .getAttribute(Globals.MAPPING_KEY);
            if (actionConfig != null)
            {
                if (actionConfig.getAttribute() != null
                        && actionConfig.getScope().equals("request"))
                {
                    ActionForm actionForm = (ActionForm) request
                            .getAttribute(actionConfig.getAttribute());
                    context.setActionForm(actionForm);
                    Boolean requestCancelled = (Boolean) request
                            .getAttribute(Globals.CANCEL_KEY);
                    if (requestCancelled != null
                            && requestCancelled.booleanValue())
View Full Code Here

            }
            HttpServletRequest req = (HttpServletRequest) request;
            StrutsPortletRenderContext context = new StrutsPortletRenderContext();
            context.setPath(path);
            context.setDispatchNamed(named);
            ActionConfig actionConfig = (ActionConfig) request
                    .getAttribute(Globals.MAPPING_KEY);
            if (actionConfig != null)
            {
                if (actionConfig.getAttribute() != null
                        && actionConfig.getScope().equals("request"))
                {
                    ActionForm actionForm = (ActionForm) request
                            .getAttribute(actionConfig.getAttribute());
                    context.setActionForm(actionForm);
                    Boolean requestCancelled = (Boolean) request
                            .getAttribute(Globals.CANCEL_KEY);
                    if (requestCancelled != null
                            && requestCancelled.booleanValue())
View Full Code Here

        // Calculate and cache the form name
        FormComponent form = (FormComponent) component;
        String action = form.getAction();
        ModuleConfig moduleConfig = form.lookupModuleConfig(context);
        ActionConfig actionConfig = moduleConfig.findActionConfig(action);
        if (actionConfig == null) {
            throw new IllegalArgumentException("Cannot find action '" +
                                               action + "' configuration");
        }
        String beanName = actionConfig.getAttribute();
        if (beanName != null) {
            form.getAttributes().put("beanName", beanName);
        }

        // Look up attribute values we need
View Full Code Here

TOP

Related Classes of org.apache.struts.config.ActionConfig

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.