You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Aaron Bartell <aa...@gmail.com> on 2005/01/15 23:18:14 UTC
Convert/Lookup Suggestions
Just curious as to how others would implement this example.
Let's say I have an Order object that has a field called prdCde (product
code). The value for product code that I store in the Order object is
it's unique id. That unique id is associated with a Description in the
PRDCDELUP (Product Code Lookup) table.
I am displaying a list of Order objects using <h:datatable> and when I
get to the "Product Code" column I want to display the description of
the product code rather than it's unique id, because the unique id will
mean nothing to the user. My thought is to build a custom converter to
do this but am wondering if that is the right direction to go or not.
I know I could do it other ways, but it seems I would always be messing
with my model objects, making them provide lookups that they should not
have to do (i.e. having the Order object provide a method called
getPrdCdeDescr() just isn't the way I want to go)
Thoughts?
Aaron Bartell
Re: Convert/Lookup Suggestions
Posted by Heath Borders <he...@gmail.com>.
I'm in a similar situation. Basically all of our objects have unique
ids. I built a stateful converter that maps the id to the object.
The converter lives in the session, and it can't be registered because
a registered converter is created new for each request, possibly for
each conversion.
On Sat, 15 Jan 2005 16:18:14 -0600, Aaron Bartell
<aa...@gmail.com> wrote:
> Just curious as to how others would implement this example.
>
> Let's say I have an Order object that has a field called prdCde (product
> code). The value for product code that I store in the Order object is
> it's unique id. That unique id is associated with a Description in the
> PRDCDELUP (Product Code Lookup) table.
>
> I am displaying a list of Order objects using <h:datatable> and when I
> get to the "Product Code" column I want to display the description of
> the product code rather than it's unique id, because the unique id will
> mean nothing to the user. My thought is to build a custom converter to
> do this but am wondering if that is the right direction to go or not.
>
> I know I could do it other ways, but it seems I would always be messing
> with my model objects, making them provide lookups that they should not
> have to do (i.e. having the Order object provide a method called
> getPrdCdeDescr() just isn't the way I want to go)
>
> Thoughts?
> Aaron Bartell
>
>
--
-Heath Borders-Wing
hborders@mail.win.org