File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Updating DB automatically ! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Updating DB automatically !" Watch "Updating DB automatically !" New topic
Author

Updating DB automatically !

Swapna Gouri Kalanidhi
Ranch Hand

Joined: Mar 14, 2008
Posts: 107
Hi All
I have a program where I'm displaying a set of names in the form of a drop-down list using HTML on the browser. At present there are few names, but in future will add more to database. Now, my problem is, even the new names should get added to the drop down list automatically, without updating the HTML. How can I do this? How can the data be fetched directly from the database and at the same time be displayed in the drop down list?

Am using JSPs and servlets as back-end to update the database and display. Is there any way out for this or should one hard code to get the data displayed on the drop-down list?


Thanks & Regards
Swapna Gouri
I "try", I "catch" and "finally" WIN !!!
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Swapna Gouri Kalanidhi wrote:Hi All
At present there are few names, but in future will add more to database. Now, my problem is, even the new names should get added to the drop down list automatically, without updating the HTML.



AJAX, Have you used it ? If not, AJAX will solve problem, without hard coding any database values in HTML !!
Just on onLoad () function of HTML page, call AJAX and it will populate the drop-down list.

Just search dependent dropdowns + AJAX


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Swapna Gouri Kalanidhi
Ranch Hand

Joined: Mar 14, 2008
Posts: 107
Hello Sagar
Thanks for the quick reply ! I haven't used Ajax till date and have no idea about Ajax. I'm a newbie to Java technologies. Instead of Ajax, is there any other way I can populate the data? I mean, is it not possible using JSPs or servlets or JSTL or such technologies? Because my entire project is on MVC architecture. And am almost reaching the deadline, so I cannot afford to learn a new technology at this point of time and apply.

Any suggestions would be much appreciated. Thanks again for your quick response !
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
"Ajax" is nothing more than a buzzword indicating an use technique. The actual languages involved are just plain Javascript, HTML DOM and XML, which existed more than 10 years each. On the server side you can do anything to your taste. If it is a Java EE environment, you can use a simple servlet for example.

To start, I can recommend this simple tutorial: http://www.w3schools.com/Ajax/Default.Asp

The actual Ajax solution which you´re looking for here is "Ajax poll". Let the webpage poll the server at certain intervals for updates. If there is any, then just update the dropdown using JS+DOM.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Updating DB automatically !