wood burning stoves 2.0*
The moose likes JSF and the fly likes inject DAO in JSF converter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "inject DAO in JSF converter" Watch "inject DAO in JSF converter" New topic
Author

inject DAO in JSF converter

Alec Swan
Ranch Hand

Joined: Feb 03, 2005
Posts: 39

Hi,

I have selectOneListbox JSF component, which I populate with a list of MyItem objects, where MyItem class extends javax.faces.model.SelectItem.

I created MyItemConverter, which has getAsString(..) method that converts a given MyItem instance to String. However, in order to implement getAsObject(..) I need to look up MyItem record in the database by its String representation.

So, my question is how can I inject a MyItemDAO instance into MyItemConverter to allow the converter to use the DAO to look up the item from the database?

Thanks.

Alec
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: inject DAO in JSF converter
 
Similar Threads
unique identifier of an instance
How to Use Spring AOP for Auditing?
opening database in servlet
Making the Data Class a Singleton & Thread Safe
Architecture question with JSF