hi,

actualy i want to bring values from servlet to the dropdown of jsp.
in my servlet i fetch the values from the database into the variable and now i want to list thosevalues in the dropdown of jsp page.
please provide me the syntax for that.

Recommended Answers

All 2 Replies

Did you tried forward technique..

RequestDispatcher rd = request.getRequestDispatch("url?newparam=newvalue");

rd.forward(request, response);

once you retrieve the data for the dropdown list from the database, what type of variables do you save it in? where is that declared?

The simplest thing to populate your dropdown would be to drop the servlet completly and put the database code in a java class, which you call from the jsp page directly, either from a function that returns a list/array~ or from a public variable directly, both can be static or not depending on your needs. At which point you can start looping through the data to populate the dropdown.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.