• Post Reply Bookmark Topic Watch Topic
  • New Topic

how can i insert values from database into drop down list  RSS feed

 
sara ali
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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 ]
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • 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.
     
    pradeep jaladi
    Ranch Hand
    Posts: 65
    • Mark post as helpful
    • send pies
    • 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
     
    Ramaswamy Srinivasan
    Ranch Hand
    Posts: 295
    • Mark post as helpful
    • send pies
    • 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
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!