• 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

how to retrieve checked box data(e.g. multiple skills) from database

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have created student registration form where i used a check box to select skills. i have saved the data into the database successfully

now i want to retrieved data but there is a problem with check box data i.e skills. there are multiple skills in skill column and i want all these skills to be fetched from database into the combo box

what should i have to use to fetched this data? do i need to use array or something like that
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your question is very vague, but I'll try to see if I can glean what you are asking.

You have a list of skills saved in the database. You need to get those skills from the DB, and then present them on a JSP in the form of a dropdown (select element). So far, so good?

If so:
  • When the page controller for the page gets a request, it will call the model class that's responsible for obtaining the list of skills.
  • The model class will interact with the database and return the list of skills as either a List or Map implementation. It will not return a resultset.
  • A List would be used of the values and display text of the dropdowm are to be the same. More commonly, the value will be an ID of some type, with some display text. An exmple from one of my systems: 6 is the ID for Snow, 14 is the ID for Hail, and 22 the ID for Tornado. So I'd use a Map associating these values.
  • The page controller creates a scoped variable in request scope to hold the List or Map, and forwards to the JSP.
  • In the JSP, the JSTL and EL (not Java code) is used to iterate over the List or Map to create the markup for the select element serving as the dropdown.


  • If any of this seems odd to you, please read this article to understand how JSP operates, or, more importantly, this article to understand how to properly structure Java web apps.
     
    Bhagyashri Chaudhari
    Greenhorn
    Posts: 8
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    ok.

    thank you.
    reply
      Bookmark Topic Watch Topic
    • New Topic