• 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 can i insert values from database into drop down list

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
i m very new in java....now i want to get the values from database and inert into drop down list in java script or java..like i want to show all the designations and departments from database into list in registration form.

Advance thx

[Bear: not so urgent]
[ November 18, 2004: Message edited by: Bear Bibeault ]
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


in java script or java


Well you could do it in JavaScript, assuming you mean serverside JavaScript running on a server which supports that. I suspect however that it would be easier to do this in Java (Note: you may well be aware, but JavaScript and Java are entirely unconnected technologies).

You say you are very new to Java, so I assume you need to start at the very basics:
  • Learn about the serverside options Java offers, namely JSP and Servlets
  • Learn about JDBC, the technology Java offers to connect to a Database.
  • Download an open source web container (Tomcat is the obvious choice) and start trying things out.


  • This is all assuming that you are not so new to Java that you are still learning the basics of the language (by which I mean syntax and core API). If you are still not very confident don't bother doing any of this till you've learned more of the basics, since as soonj as you start to use container and resources like databases, what could be going wrong with your code gets harder to spot.
     
    Ranch Hand
    Posts: 65
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    hai i am also look for the same applications could u plz send this is in jsp
    to populate the values
     
    Ranch Hand
    Posts: 295
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi,

    Am I right in understanding your problem, as to fetch some values, say for
    example 5 values from a table in the DB and display them in the dropdown
    in your JSP page?

    If this is right, I think the following might be of some use to you.

    One way to go about it is to use a bean, with a method say fetchNames(), that would return a ResultSet. This methods will fetch all the names in the table, to be populated into the names dropdown in the page.

    In your JSP page, we can call this method and iterate through the ResultSet to get the values into the dropdown.

    This code snippet is as follows



    Hope this helps you. Any better Idea guys?

    Cheers,
    Swamy
     
    You are HERE! The other map is obviously wrong. Better confirm with this tiny ad:
    a bit of art, as a gift, that will fit in a stocking
    https://gardener-gift.com
    reply
      Bookmark Topic Watch Topic
    • New Topic