Afterall the user will be served some HTML (select box in this case) , so you have to generate the select box dynamically (since the values getting from the DB). So you should use DOM objects for that.
Prasanna RamKumar wrote:if iam using the servlet to fetch the values first how can i call the servlet first. should i use any listeners to call the servlet. So that it will first fetch values and set in request attribute so that i can get the attribute in my request scope of jsp
Use a URL mapping to the servlet for that specific request from the user then in the servlet you can set the List (or what ever) in the request scope and forward the request to the appropriate jsp.
As Far As I am understanding,You should put your collection(say arraylist) of country in session before the page loads ,and then just fetch and iterate that session value in your select box .
I think you are getting my point In case of any problem please let me know .
God Gave Me Nothing I Wanted, He Gave Me Everything I Needed.
OCPJP6
If the values don't change over the life-cycle of the application, you can use a Context Listener that will execute once at application startup, and store the values in application context where they will be available for the life of the application.