If you're using domain objects or persisting the data, I would suggest
you use Object properties. Say, for instance, that you have an Invoice
domain object. You might have an CreateInvoiceAction Action class:

Public class CreateInvoiceAction extends ActionSupport {
   private Invoice invoice = new Invoice();

   ...
}

Then your form properties would look like:


<input type="text" name="invoice.poNum" value="${invoice.poNum}"/>

This would call getInvoice().getPoNum() to get the value, and
getInvoice().setPoNum() to set the value.

The idea behind no formbeans is that you don't need special beans just
to represent the form. You can use properties on your Action to hold
some properties (for instance control params which affect the
processing) and domain objects for the real data. Or you can put all the
properties on your Action. You can even create form beans, if you want
to. You can choose, unlike some other frameworks where they are
mandatory. 

Jason

> -----Original Message-----
> From: Anoop Ranganath [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, September 17, 2003 2:27 AM
> To: [EMAIL PROTECTED]
> Subject: [OS-webwork] formbean vs. action
> 
> 
> So coming from other frameworks, I'm surprised to see that while 
> allowing FormBeans, WW2 doesn't encourage them anymore than just 
> putting the properties on the action.  While I can't see a 
> problem with 
> it, there's a voice in my head telling me to run away screaming.
> 
> As my last post mentioned, Hibernate is being used as the persistence 
> mechanism, so persisting the action w/properties is equivalent to 
> persisting a bean.  I do have a few reservations.
> 
> 1)  How would you deal with two different objects in a form.  I'm 
> guessing save all of their properties avoiding name 
> collisions and then 
> mapping them into the two separate object.  Essentially the same as 
> using formbeans, but relieves the template from having to know about 
> the underlying object model.
> 
> 2)  I can't think of a situation off hand where this would 
> happen, but 
> what if two actions that worked with the same business entity both 
> needed to persist it.  Even if they extended the same base class, I 
> would either have to specify mappings for both of them into the same 
> table or chain them together and allow only one of them to persist.  
> (This might be more of a Hibernate question).
> 
> To sum it all up, is there any reason to _not_ use a formbean?  It 
> seems the only reason to not use it is because you don't have 
> to.  Does 
> that sound right?
> 
> Anoop
> 
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf 
> _______________________________________________
> Opensymphony-webwork mailing list 
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
> 


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to