wood burning stoves 2.0*
The moose likes Struts and the fly likes Struts Design Consideration for LabelValueBean 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 » Frameworks » Struts
Bookmark "Struts Design Consideration for LabelValueBean" Watch "Struts Design Consideration for LabelValueBean" New topic

Struts Design Consideration for LabelValueBean

Yogendra Joshi
Ranch Hand

Joined: Apr 04, 2006
Posts: 213
Howdy Ranchers,

I am currently working on populating a dropdown from a list of school id's and I am not sure if returning a list of LabelValueBean from Data Access Layer is a good approach? What I mean to say is, I have a application which follows EJB architecture where entry point is the Struts Action or the Command class followed by the Business Delegate-> EJB-> Application Service -> DAO - DB. Now in the DAO layer, I have a query to which I pass the list of school id's and it returns me the filtered list of schools which are present in the Database along with their name. So I have a School Name and School Id which I would like to put into LabelValueBean("schoolName","schoolId") and then returning it to the action, set it into Session / Request attribute and then populate the dropdown using .

Is it preferable to return a list of LabelValueBean from the DAO layer like:

Please help me out on the same.


Meri Zindagi Hain Tab Tak.. Jab Tak Tera Sahara.... Har Taraf Tu Hi Tu Hain SAI Tera Hi Hain Nazara.....
Karthik Jayachandran
Ranch Hand

Joined: Feb 18, 2009
Posts: 88

You can use any value object from your model layer which has the fields with getters and setters.

For eg.,

Just mention the label and value properties in labelProperty and property attributes respectively.

It is sorta covered in the JavaRanch Style Guide.
subject: Struts Design Consideration for LabelValueBean
Similar Threads
Select Tag
Caching of Database Access Objects's possible?
optionsCollection syntax trouble
Help me see if possible Generic DAO Factory
Ajax repose as reponseXML