• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Bhagyashri Chaudhari
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • 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
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
    • Quote
    • Report post to moderator
    ok.

    thank you.
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!