Package org.apache.struts.config

Examples of org.apache.struts.config.FormBeanConfig


        FormBeanConfig[] formBeans = moduleConfig.findFormBeanConfigs();
        ReloadableClassHandler rch = _handlers.getReloadableClassHandler();

        for ( int i = 0; i < formBeans.length; i++ )
        {
            FormBeanConfig formBeanConfig = formBeans[i];
            String formType = InternalUtils.getFormBeanType( formBeanConfig );

            try
            {
                Class formBeanClass = rch.loadClass( formType );
                _formBeanClasses.put( formBeanConfig.getName(), formBeanClass );
            }
            catch ( ClassNotFoundException e )
            {
                LOG.error( "Could not load class " + formType + " referenced from form bean config "
                            + formBeanConfig.getName() + " in Struts module " + moduleConfig );
            }
        }
    }
View Full Code Here


            }
        }

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

                _beanScope = "session";
            return;
        }

        // Look up the form bean definition
        FormBeanConfig formBeanConfig = _appConfig.findFormBeanConfig(_mapping.getName());
        if (formBeanConfig == null) {
            // clear any _beanType
            _beanType = null;
        }
        else {
            // Calculate the required values
            _beanName = _mapping.getAttribute();
            _beanScope = _mapping.getScope();
            _beanType = formBeanConfig.getType();
        }
    }
View Full Code Here

        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

    public static ActionForm createActionForm( ActionMapping mapping, ModuleConfig moduleConfig,
                                               ActionServlet actionServlet, ServletContext servletContext )
    {
        String formName = mapping.getName();
        if ( formName == null ) return null;
        FormBeanConfig config = moduleConfig.findFormBeanConfig( formName );
        if ( config == null ) return null;

        try
        {
            ActionForm bean;

            if ( config.getDynamic() )
            {
                if ( _log.isDebugEnabled() )
                {
                    _log.debug( "Creating new DynaActionForm instance of type " + config.getType() );
                }

                DynaActionFormClass dynaClass = DynaActionFormClass.createDynaActionFormClass( config );
                bean = ( ActionForm ) dynaClass.newInstance();
                ( ( DynaActionForm ) bean ).initialize( mapping );
            }
            else
            {
                if ( _log.isDebugEnabled() )
                {
                    _log.debug( "Creating new ActionForm instance of type " + config.getType() );
                }

                bean = ( ActionForm ) newReloadableInstance( config.getType(), servletContext );
            }

            bean.setServlet( actionServlet );
            return bean;
        }
        catch ( Exception e )
        {
            if ( _log.isErrorEnabled() )
            {
                _log.error( "Error creating action form of type " + config.getType(), e );
            }

            return null;
        }
    }
View Full Code Here

  public DynamicModuleConfig(String prefix) {
    super(prefix);
  }

  public FormBeanConfig findFormBeanConfig(String name) {
    FormBeanConfig result = super.findFormBeanConfig(name);
    if(result == null) {
      addFormBeanConfigByClassName(name);
      return super.findFormBeanConfig(name);
    }
    return result;
View Full Code Here

  void addFormBeanConfigByClassName(String className) {
    if(!isValidClassName(className)) {
      return;
    }
    defreeze();
    FormBeanConfig formBeanConfig = new FormBeanConfig();
    formBeanConfig.setName(className);
    formBeanConfig.setType(className);
    addFormBeanConfig(formBeanConfig);
  }
View Full Code Here

            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

        String name = mapping.getName();
        if (name == null) {
            return;
        }
        FormBeanConfig config =
            mapping.getModuleConfig().findFormBeanConfig(name);
        if (config == null) {
            return;
        }
View Full Code Here

     * 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

TOP

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

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.