You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by ni...@apache.org on 2004/06/09 02:25:52 UTC

cvs commit: jakarta-struts/src/share/org/apache/struts/util RequestUtils.java

niallp      2004/06/08 17:25:52

  Modified:    src/share/org/apache/struts/util RequestUtils.java
  Log:
  Changes for bug 28668/22207
  
  Revision  Changes    Path
  1.150     +22 -42    jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java
  
  Index: RequestUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java,v
  retrieving revision 1.149
  retrieving revision 1.150
  diff -u -r1.149 -r1.150
  --- RequestUtils.java	8 Apr 2004 22:07:56 -0000	1.149
  +++ RequestUtils.java	9 Jun 2004 00:25:52 -0000	1.150
  @@ -190,7 +190,7 @@
               return (null);
           }
   
  -        return createActionForm(config, moduleConfig, servlet);
  +        return createActionForm(config, servlet);
       }
   
   
  @@ -275,13 +275,11 @@
        * which could be reused.</p>
        *
        * @param config The configuration for the Form bean which is to be created.
  -     * @param moduleConfig The configuration for the current module.
        * @param servlet The action servlet
        *
        * @return ActionForm instance associated with this request
        */
  -    public static ActionForm createActionForm(FormBeanConfig config, ModuleConfig moduleConfig,
  -                                              ActionServlet servlet)
  +    public static ActionForm createActionForm(FormBeanConfig config, ActionServlet servlet)
       {
           if (config == null)
           {
  @@ -289,46 +287,28 @@
           }
   
           ActionForm instance = null;
  +
           // Create and return a new form bean instance
  -        if (config.getDynamic()) {
  -            try {
  -                DynaActionFormClass dynaClass =
  -                        DynaActionFormClass.createDynaActionFormClass(config, moduleConfig);
  -                instance = (ActionForm) dynaClass.newInstance();
  -                ((DynaActionForm) instance).initialize(config);
  -                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);
  +        try {
  +
  +            instance = config.createActionForm(servlet);
  +            if (log.isDebugEnabled()) {
  +                log.debug(
  +                        " Creating new "
  +                        + (config.getDynamic() ? "DynaActionForm" : "ActionForm")
  +                        + " instance of type '"
  +                        + config.getType()
  +                        + "'");
  +                log.trace(" --> " + instance);
               }
  +
  +        } catch(Throwable t) {
  +            log.error(servlet.getInternal().getMessage("formBean", config.getType()), t);
           }
  -        instance.setServlet(servlet);
  +
           return (instance);
   
       }
  -
   
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org