Examples of FormBeanConfig


Examples of org.apache.struts.config.FormBeanConfig

            this.parseModuleConfigFile(prefix, paths, config, digester, path);
        }

        // Force creation and registration of DynaActionFormClass instances
        // for all dynamic form beans we wil be using
        FormBeanConfig fbs[] = config.findFormBeanConfigs();
        for (int i = 0; i < fbs.length; i++) {
            if (fbs[i].getDynamic()) {
                DynaActionFormClass.createDynaActionFormClass(fbs[i]);
            }
        }
View Full Code Here

Examples of org.apache.struts.config.FormBeanConfig

     * @since Struts 1.1
     * @deprecated Will be removed in a release after Struts 1.1.
     */
    private void defaultFormBeansConfig(ModuleConfig config) {

        FormBeanConfig fbcs[] = config.findFormBeanConfigs();
        ActionFormBeans afb = new ActionFormBeans();
        afb.setFast(false);
        for (int i = 0; i < fbcs.length; i++) {
            afb.addFormBean((ActionFormBean) fbcs[i]);
        }
View Full Code Here

Examples of org.apache.struts.config.FormBeanConfig

     * Return the form bean configurations for this module.  If there
     * are none, a zero-length array is returned.
     */
    public FormBeanConfig[] findFormBeanConfigs() {

        FormBeanConfig results[] = new FormBeanConfig[formBeans.size()];
        return ((FormBeanConfig[]) formBeans.values().toArray(results));

    }
View Full Code Here

Examples of org.apache.struts.config.FormBeanConfig

            return (null);
        }

        // Look up the form bean configuration information to use
        String name = mapping.getName();
        FormBeanConfig config = moduleConfig.findFormBeanConfig(name);
        if (config == null) {
            return (null);
        }

        // Look up any existing form bean instance
        if (log.isDebugEnabled()) {
            log.debug(
                " Looking for ActionForm bean instance in scope '"
                    + mapping.getScope()
                    + "' under attribute key '"
                    + attribute
                    + "'");
        }
        ActionForm instance = null;
        HttpSession session = null;
        if ("request".equals(mapping.getScope())) {
            instance = (ActionForm) request.getAttribute(attribute);
        } else {
            session = request.getSession();
            instance = (ActionForm) session.getAttribute(attribute);
        }

        // Can we recycle the existing form bean instance (if there is one)?
        if (instance != null) {
            if (config.getDynamic()) {
                String className = ((DynaBean) instance).getDynaClass().getName();
                if (className.equals(config.getName())) {
                    if (log.isDebugEnabled()) {
                        log.debug(
                            " Recycling existing DynaActionForm instance "
                                + "of type '"
                                + className
                                + "'");
                        log.trace(" --> " + instance);
                    }
                    return (instance);
                }
            } else {
                try {
                    Class configClass = applicationClass(config.getType());
                    if (configClass.isAssignableFrom(instance.getClass())) {
                        if (log.isDebugEnabled()) {
                            log.debug(
                                " Recycling existing ActionForm instance "
                                    + "of class '"
                                    + instance.getClass().getName()
                                    + "'");
                            log.trace(" --> " + instance);
                        }
                        return (instance);
                    }
                } catch (Throwable t) {
                    log.error(servlet.getInternal().getMessage("formBean", config.getType()), t);
                    return (null);
                }
            }
        }

        // Create and return a new form bean instance
        if (config.getDynamic()) {
            try {
                DynaActionFormClass dynaClass =
                    DynaActionFormClass.createDynaActionFormClass(config);
                instance = (ActionForm) dynaClass.newInstance();
                ((DynaActionForm) instance).initialize(mapping);
                if (log.isDebugEnabled()) {
                    log.debug(
                        " Creating new DynaActionForm instance "
                            + "of type '"
                            + config.getType()
                            + "'");
                    log.trace(" --> " + instance);
                }
            } catch (Throwable t) {
                log.error(servlet.getInternal().getMessage("formBean", config.getType()), t);
                return (null);
            }
        } else {
            try {
                instance = (ActionForm) applicationInstance(config.getType());
                if (log.isDebugEnabled()) {
                    log.debug(
                        " Creating new ActionForm instance "
                            + "of type '"
                            + config.getType()
                            + "'");
                    log.trace(" --> " + instance);
                }
            } catch (Throwable t) {
                log.error(servlet.getInternal().getMessage("formBean", config.getType()), t);
                return (null);
            }
        }
        instance.setServlet(servlet);
        return (instance);
View Full Code Here

Examples of org.apache.struts.config.FormBeanConfig

        if (log.isTraceEnabled()) {
            log.trace("Performing standard action form processing");
            String attribute = mapping.getAttribute();
            if (attribute != null) {
                String name = mapping.getName();
                FormBeanConfig fbc = moduleConfig.findFormBeanConfig(name);
                if (fbc != null) {
                    if ("request".equals(mapping.getScope())) {
                        log.trace("  Bean in request scope = " +
                                  request.getAttribute(attribute));
                    } else {
View Full Code Here

Examples of org.apache.struts.config.FormBeanConfig

            pageContext.setAttribute(Globals.EXCEPTION_KEY, e, PageContext.REQUEST_SCOPE);
            throw e;
        }

        // Look up the form bean definition
        FormBeanConfig formBeanConfig = moduleConfig.findFormBeanConfig(mapping.getName());
        if (formBeanConfig == null) {
            JspException e =
                new JspException(messages.getMessage("formTag.formBean", mapping.getName(), action));
            pageContext.setAttribute(Globals.EXCEPTION_KEY, e, PageContext.REQUEST_SCOPE);
            throw e;
        }

        // Calculate the required values
        beanName = mapping.getAttribute();
        beanScope = mapping.getScope();
        beanType = formBeanConfig.getType();
    }
View Full Code Here

Examples of org.apache.struts.config.FormBeanConfig

            Globals.MODULE_KEY + config.getPrefix(),
            config);

        // Force creation and registration of DynaActionFormClass instances
        // for all dynamic form beans we wil be using
        FormBeanConfig fbs[] = config.findFormBeanConfigs();
        for (int i = 0; i < fbs.length; i++) {
            if (fbs[i].getDynamic()) {
                fbs[i].getDynaActionFormClass();
            }
        }
View Full Code Here

Examples of org.apache.struts.config.FormBeanConfig

        if (log.isTraceEnabled()) {
            log.trace("Performing standard action form processing");
            String attribute = mapping.getAttribute();
            if (attribute != null) {
                String name = mapping.getName();
                FormBeanConfig fbc = moduleConfig.findFormBeanConfig(name);
                if (fbc != null) {
                    if ("request".equals(mapping.getScope())) {
                        log.trace("  Bean in request scope = " +
                                  request.getAttribute(attribute));
                    } else {
View Full Code Here

Examples of org.apache.struts.config.FormBeanConfig

        String name = mapping.getName();

        assert name != null : mapping.getPath();
        if ( name == null ) return null;

        FormBeanConfig config = moduleConfig.findFormBeanConfig( name );
        ActionForm instance;
       
        //
        // Create the form bean.  There's special handling for dyna-form-beans.
        //
        if ( config.getDynamic() )
        {
            try
            {
                DynaActionFormClass dynaClass = DynaActionFormClass.createDynaActionFormClass( config );
                instance = ( ActionForm ) dynaClass.newInstance();
                ( ( DynaActionForm ) instance ).initialize( mapping );
               
                if ( _log.isDebugEnabled() )
                {
                    _log.debug( " Creating new DynaActionForm instance " + "of type '" + config.getType() + '\'' );
                }
            }
            catch ( Exception e )
            {
                _log.error( servlet.getInternal().getMessage( "formBean", config.getType() ), e );
                return null;
            }
        }
        else
        {
            try
            {
                instance = ( ActionForm ) InternalUtils.newReloadableInstance( config.getType(), getServletContext() );
               
                if ( _log.isDebugEnabled() )
                {
                    _log.debug( " Creating new ActionForm instance " + "of type '" + config.getType() + '\'' );
                }
            }
            catch ( Exception e )
            {
                _log.error( servlet.getInternal().getMessage( "formBean", config.getType() ), e );
                return null;
            }
        }
       
        instance.setServlet( servlet );
View Full Code Here

Examples of org.apache.struts.config.FormBeanConfig

        else
        {
            //
            // The form bean class couldn't be loaded at init time -- just check against the class name.
            //
            FormBeanConfig mappingFormBean = moduleConfig.findFormBeanConfig( mapping.getName() );
            String formClassName = formBeanClass.getName();
           
            if ( mappingFormBean != null && mappingFormBean.getType().equals( formClassName ) ) return true;
           
            if ( mapping instanceof PageFlowActionMapping )
            {
                String desiredType = ( ( PageFlowActionMapping ) mapping ).getFormClass();
                if ( formClassName.equals( desiredType ) ) return true;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.