Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts Design Consideration for LabelValueBean

 
Yogendra Joshi
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Thanks,
Yogendra
 
Karthik Jayachandran
Ranch Hand
Posts: 91
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic