This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Populatin list - EJB/STRUTS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Populatin list - EJB/STRUTS" Watch "Populatin list - EJB/STRUTS" New topic

Populatin list - EJB/STRUTS

Elijah Israel

Joined: Mar 31, 2001
Posts: 3
I am a newbie. If What I am saying does not make sense correct me please. I want to populate a list with the values from DB. What is the best approach.
1. Populate with values from entity bean.
2. Write Buisness method in a session bean to pull value from the DB with JDBC connection.
3. Use struts data source components to fetch data.
If possible supply an example implementation. (Code or link).

Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
It sounds like you could be correct using any of those solutions. You should consider additional things in deciding which one to choose. For instance, is the data stored anywhere right now? Is it easy to adapt an EJB solution for this? Do you need an EJB solution for this? Are there any transaction requirements here? Is there already an EJB solution that has the logic for you to use?
There's more to EJB than persisting data. As such, using it to do that would not be the best move. That may eliminate your choices 1 and 2. If you used a simple business delegate instead of a session bean in 2, the difference between that and 3 would only be in how you resolve your initial connection.
That should be plenty to get you started though.

Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Thanks for joining JavaRanch, but could you take a quick look at the naming policy and edit your profile accordingly.
jQuery in Action, 2nd edition
subject: Populatin list - EJB/STRUTS
Similar Threads
Pouplate list box of Struts 2 using ajax
Where to populate values for drop down box?
How to populate html:select
Updating DB using Vector
passing values of Select box from JSP to Action class thru form Bean