You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rick Reumann <st...@reumann.net> on 2005/08/23 22:20:25 UTC

[JSF] best practice for value object in backing bean - method names?

I posted this to the MyFaces list, but posting here as well since not 
sure where the best list is for posting these questions. (Ok, well, 
since Craig is active here, I'm taking advantage of that fact and 
sneaking in as many JSF posts here as I can:).....

For sake of this discussion imagine a case where user needs to click on 
a button to "get and invoice" based off an invoice ID.

Now coming from struts I'm used to going to a 'getInvoice' dispatch 
method which would return to me an "Invoice" object (after making a 
backend call) and then that "Invoice" would be stuffed into the Request 
for use on the page we forward to.

With JSF, I'm assuming you'd typically want an "InvoiceBackingBean" and 
nested in there possibly an "Inovice" value object? So then on a JSP you 
could have   invoiceBackingBean.invoice.id   This would obviously mean 
your InvoiceBackingBean would need a "getInvoice" method that would 
return the instance of the Invoice object in the backing bean.

Where I'm now confused is what do you call the actual action method in 
your BackingBean that would do the true "get" (dao/service/delegate 
call) that would populate the Invoice object in the backing bean. Aren't 
you going to run into some odd naming conventions?  Do you make another 
method called "retrieveInvoice" ? So looking at the backingBean you'll 
have "getInvoice" - returns the invoice object in backing bean, and then 
you'll also have "retrieveInvoice" - which is what your forms will call 
when submitted to populate the actual invoice in the backing bean?

How do you gurus handle this?


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