Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Struts Design Consideration for LabelValueBean

 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 93
Python Redhat Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
I hired a bunch of ninjas. The fridge is empty, but I can't find them to tell them the mission.
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic