Ted,

if you have only one formbean which contains all the properties in the 
application, doesn't the code become unmanageable?



Adam

Ted Husted wrote:

>Just to be clear, there are actually two distinct objects. 
>
>The ActionFormBean is created by the form-bean element in the Struts
>configuration. This is a descriptor that the Struts ActionServlet (or
>sometimes html:form tag) uses to create an ActionForm object. 
>
>Just to keep you on your toes, developers sometimes refer to the
>ActionForm as a formbean. 
>
>In some cases, this can actually be correct. The same ActionForm class
>can be used for in several different ActionFormBean instances. So, by
>referring to the formbean, they are referring to the particular
>ActionForm object created by a ActionFormBean instance. 
>
>Personally, I recommend minimizing the number of ActionForm classes in
>an application. Often one ActionForm that declares whatever properties
>you need is sufficient. It can then be given different identities using
>multiple form-bean declarations, as people often do with ActionMappings
>and Action classes. 
>
>The Struts Validator goes by the form-bean (or attribute) name and will
>apply the appropriate validation for each form-bean. If you are not
>using the Validator, I recommend using a base ActionForm class that
>includes all the properties an application needs and then subclassing
>that with different validate() methods. 
>
>-- Ted Husted, Husted dot Com, Fairport NY US
>-- Developing Java Web Applications with Struts
>-- Tel: +1 585 737-3463
>-- Web: http://husted.com/about/services
>
>
>Michael Delamere wrote:
>  
>
>>Thanks,
>>
>>I�m starting to get it now :-).
>>
>>I think it�s a good approach although the fact that it�s called a formBean
>>is a bit confusing.
>>
>>regards Michael
>>
>>----- Original Message -----
>>From: "Galbreath, Mark" <[EMAIL PROTECTED]>
>>To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
>>Sent: Tuesday, May 14, 2002 12:20 AM
>>Subject: RE: Getting a list from a session bean and displaying the data in a
>>jsp
>>
>>    
>>
>>>Exactly.
>>>
>>>-----Original Message-----
>>>From: Michael Delamere [mailto:[EMAIL PROTECTED]]
>>>Sent: Monday, May 13, 2002 6:20 PM
>>>To: Struts Users Mailing List
>>>Subject: Re: Getting a list from a session bean and displaying the data
>>>in a jsp
>>>
>>>
>>>Sorry to go on about this but I�m fairly new to struts and therefore I
>>>      
>>>
>>don�t
>>    
>>
>>>understand all of the connections immediately.
>>>
>>>Basically what you suggested means that I would map a listEntries.jsp to a
>>>listEntriesForm.java which would contain a function called getEntries(); ?
>>>
>>>My formBean would get filled by my *action.java using a setter method,
>>>      
>>>
>>i.e.
>>    
>>
>>>formBean.setEntries();.  Prior to this the *action.java would have got the
>>>data out of the session bean.
>>>
>>>Is this what you are suggesting or am I thinking entirely wrong?
>>>
>>>regards Michael
>>>
>>>
>>>----- Original Message -----
>>>From: "Galbreath, Mark" <[EMAIL PROTECTED]>
>>>To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
>>>Sent: Tuesday, May 14, 2002 12:05 AM
>>>Subject: RE: Getting a list from a session bean and displaying the data in
>>>      
>>>
>>a
>>    
>>
>>>jsp
>>>
>>>
>>>      
>>>
>>>>Not for every EJB, but I have a separate form bean for each JSP in which
>>>>data is collected or displayed.  I believe that is the practice
>>>>        
>>>>
>>>recommended
>>>      
>>>
>>>>by Craig.
>>>>
>>>>-----Original Message-----
>>>>From: Michael Delamere [mailto:[EMAIL PROTECTED]]
>>>>Sent: Monday, May 13, 2002 5:52 PM
>>>>To: Struts Users Mailing List
>>>>Subject: Re: Getting a list from a session bean and displaying the data
>>>>in a jsp
>>>>
>>>>
>>>>Just one question to add to the previous one:
>>>>
>>>>Does this mean that I have to create a form bean for every ejb in order
>>>>        
>>>>
>>to
>>    
>>
>>>>make it accessible to the jsp?
>>>>
>>>>regards Michael
>>>>
>>>>
>>>>----- Original Message -----
>>>>From: "Michael Delamere" <[EMAIL PROTECTED]>
>>>>To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>>>>Sent: Monday, May 13, 2002 11:46 PM
>>>>Subject: Re: Getting a list from a session bean and displaying the data
>>>>        
>>>>
>>in
>>    
>>
>>>a
>>>      
>>>
>>>>jsp
>>>>
>>>>
>>>>        
>>>>
>>>>>Thanks,
>>>>>
>>>>>I will try it.
>>>>>
>>>>>regards Michael
>>>>>
>>>>>
>>>>>----- Original Message -----
>>>>>From: "Galbreath, Mark" <[EMAIL PROTECTED]>
>>>>>To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
>>>>>Sent: Monday, May 13, 2002 11:02 PM
>>>>>Subject: RE: Getting a list from a session bean and displaying the
>>>>>          
>>>>>
>>data
>>    
>>
>>>in
>>>      
>>>
>>>>a
>>>>        
>>>>
>>>>>jsp
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>>>Declare a form bean with session scope associated with your action
>>>>>>            
>>>>>>
>>>class
>>>      
>>>
>>>>>and
>>>>>          
>>>>>
>>>>>>forwarded to the JSP in struts-config.  Use your action class to set
>>>>>>            
>>>>>>
>>>the
>>>      
>>>
>>>>>>bean's properties and then access the lists with <iterate> and
>>>>>>            
>>>>>>
>>>>individual
>>>>        
>>>>
>>>>>>properties with <bean:write>.
>>>>>>
>>>>>>Mark
>>>>>>
>>>>>>-----Original Message-----
>>>>>>From: Michael Delamere [mailto:[EMAIL PROTECTED]]
>>>>>>Sent: Monday, May 13, 2002 4:01 PM
>>>>>>To: 'Struts Users Mailing List' (E-mail)
>>>>>>Subject: Getting a list from a session bean and displaying the data
>>>>>>            
>>>>>>
>>in
>>    
>>
>>>a
>>>      
>>>
>>>>>>jsp
>>>>>>
>>>>>>
>>>>>>Hi,
>>>>>>
>>>>>>I�ve got a session bean which returns an Object[] array of entity
>>>>>>            
>>>>>>
>>>beans.
>>>      
>>>
>>>>>In
>>>>>          
>>>>>
>>>>>>my action file I get the array via a jndiContext.lookup.  That�s all
>>>>>>            
>>>>>>
>>>no
>>>      
>>>
>>>>>>problem and I can retreive my data out of the entity beans.
>>>>>>
>>>>>>However, I�m slightly stuck getting them over to my jsp file.  I�ve
>>>>>>            
>>>>>>
>>>>tried
>>>>        
>>>>
>>>>>>request.setAttribute("entryList", entryList);
>>>>>>
>>>>>>and then outputing the data with:
>>>>>>
>>>>>><nested:iterate property="entryList">
>>>>>>  <tr>
>>>>>>    <td><nested:text property="entry_subject" /></td>
>>>>>>    <td><nested:text property="entry_text" /></td>
>>>>>>    <td><nested:text property="entry_date" /></td>
>>>>>>  </tr>
>>>>>></nested:iterate>
>>>>>>
>>>>>>Could someone give me an insight of how this is done.
>>>>>>I would be most grateful.
>>>>>>
>>>>>>Thanks,
>>>>>>
>>>>>>Michael
>>>>>>            
>>>>>>
>
>--
>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
>  
>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to