You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Rick Reumann <ri...@gmail.com> on 2005/08/23 22:11:24 UTC
confusion on best practices in regard to a VO in BackingBean
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<http://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?
--
Rick
Re: confusion on best practices in regard to a VO in BackingBean
Posted by Martin Marinschek <ma...@gmail.com>.
Yes.
this is exactly how I handle this. If naming convention strikes you as
a problem, you can always name the retrieveInvoice method a
retrieveInvoiceAction method or something in the like.
>From the method signature it will be clear that this is an action
method and not the getter anyways, cause you return a string.
regards,
Martin
On 8/23/05, Rick Reumann <ri...@gmail.com> wrote:
> 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?
>
> --
> Rick
--
http://www.irian.at
Your JSF powerhouse -
JSF Trainings in English and German