You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Paul Benedict (JIRA)" <ji...@apache.org> on 2006/11/18 07:33:58 UTC

[jira] Updated: (STR-1072) Struts framework should use getInstance Method for instantiating FormBeans

     [ http://issues.apache.org/struts/browse/STR-1072?page=all ]

Paul Benedict updated STR-1072:
-------------------------------

      Bugzilla Id:   (was: 15604)
    Fix Version/s: 1.2.4
                       (was: 2.0 Family)
         Assignee:     (was: Struts Developers)

> Struts framework should use getInstance Method for instantiating FormBeans
> --------------------------------------------------------------------------
>
>                 Key: STR-1072
>                 URL: http://issues.apache.org/struts/browse/STR-1072
>             Project: Struts 1
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: Nightly Build
>         Environment: Operating System: All
> Platform: All
>            Reporter: James David
>            Priority: Minor
>             Fix For: 1.2.4
>
>
> Suggession  
> Instead of instantiating formbeans using newInstance of reflection API,
> if struts gives the developer with a getInstance method.  Developer 
> will have the liberty to either create a new instance or return a Proxy
> Instance.
> Disadvantage with the existing framework :
>             1. FormBean may grow large depending upon the number of fields used.
>             2. When form data is required for backend purpose, Data from 
>                formbean has to be copied to another 'application specific 
>                Object', this is just to decouple struts from my application.
>              
> Advantages when struts invokes a getInstance() method on the FormBean
>              1. I need have any variables in my form bean
>              2. I need not write getter/setter methods in my form bean
>              3. I need not transfer data from formbean (frontend) to my 
>                 application specific data object (backend)
>              4. Adding new variable is as simple as adding setter/getter methods
>                 in the respective interface and start using the same name as 
>                 variables in my JSP.
> How :
> 	     1. I will return a Proxy Instance for the Form Bean
>              2. Write only my application specific data object to hold the data,
>                 which will have only a HashMap.
>              3. When struts framework invokes any setter method, the data will
>                 be set to my data object's HashMap as MethodName vs. Value
>            
>              4. Now theres no transfer of data required, all the data required 
>                 for my form bean is available in the data object, which is 
>                 specific to my application (not depending on struts).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira