• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Option collections problem

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello!
I have a bean called Student (with name, forname...)
All the students are stored in a database.
But when i return the collection of my students, i dont know how getting the names in my jsp page in order to do a optionscollection.
Can anyone help ?
Thanks !
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, if what you want to display is a select with all your students names, you would need to create a collection, for example a list with only the names of the students and then in your jsp you would do something like:

Hope this helps.
 
Gizzmo Zeuzere
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes sorry.I 've not noticed that i 've my collection. It's a collection of student beans. And i want to extract only their names and fornames in the select. How can i do that ?
Thanks
 
Norma Caballero
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I understand you have a property name and a property forname, separated.
So you would iterate through your beans collection and create a list...for example:

In your formbean you must have a property to set the list and then you would do:

And in your jsp you would do something like the example I gave you on my previous reply.
Hope I made myself clear Good luck!
 
Norma Caballero
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry I didn't specify something. The iteration an creation of the list should not be done in the jsp, in the jsp you only put the select tag. You could do this in your action class or somewhere else.
 
Gizzmo Zeuzere
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Re hello !
My real problem is not the realisation of the collection.
I've the collection with all my students.
My problem is how to access to an attribute of the collection in the jsp
<html:select .... ?
But Thank for your responses
 
Norma Caballero
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I don't understand what you are trying to do.. I would like to help.
 
Clowns were never meant to be THAT big! We must destroy it with this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic