I want to retrieve data based on what I select the option from the dropdown menu.
This dropdown menu has ID values of the table, which I have already created.
Please can you assist me retrieving the related data from the database on selecting the ID?
I have dynamically retrieved the ID values from database table into dropdown menu.
On selecting value from the dropdown, I want to display the related data using java code.
Have you got a method in your db layer to retrieve something based on a given ID?
How do you want to retrieve the thing whose ID has been selected? Are we talking a RESTful service call?
If so, have you managed to write the code on the client to make that call? Is there an endpoint on the server that can receive that request?
I have a drop down ..the dropdown has the primary key ID values from table which are dynamically stored.
Say the values dropdown contains is 1, 2, 3. Till this I have done coding. I am even able to generate output for it using below code.
Now if I select the option 1, it should display the related records with respect to that id i.e the data with ID = 1.
How can I code it?
Before you dive head-first into using AJAX, I think you need to catch up with basic knowledge.
So start with a basic HTML form which contains that <select> element and arrange things so that it submits to a servlet which handles the selected option appropriately. You can generate that HTML with your Java code, as you are doing now, if you like.
There’s no place like 127.0.0.1. But I'll always remember this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop