I wants to know that is it possible that, when i select the option from drop-down menu on jsp page ,it sends it on servlet and return back to same page with results as per option was selected.
Like, if I am selecting country name from drop-down menu at a time page is refreshed and the value below that country options which is ,options for cities are available with indian cities!!
I have tried to find but, in each code javascript is their...Is it possible without javascript?
Doing this with JavaScript is the correct and modern way. Back before Ajax, you had to submit and refresh the whole page. You can still do that, but it will make your application looks like it was written 10 years ago.
Sort of like building a car today using a crank in the front to turn the motor.
Most modern sites use Javascript to provide a dynamic interface, almost every browser supports it. Personally I would use the onChange event on the dropdown box and use an Ajax approach to request and display the results. I hate sites that refresh or reload the whole page when you select something; it looks so outdated and clunky. You can write your own ajax code or use some 3rd party solutions.
Ok..then can you give some advise on how to do this task?
and also that ,can javascript interact with FormBeans to get values from FromBean?
(I don't know javascript, so sorry If you found this questions stupid)
What's a FormBean? It's not part of Servlets or JSP.
In any case, no: JavaScript, which executes on the client after the HTML is generated and delivered as the response, cannot directly interact with Java code running on the server to create that response.
There are likely hundreds to thousands of examples of doing this on the Web. Please search.
If you want to use jQuery for your Ajax and JavaScript needs (you should use a library, Ajax has too many cross-browser nuances to do it yourself) you can grab the free sample source code for my jQuery book. The code for chapter 8 shows how to use Ajax and JSP to populate dropdowns dynamically
Thanks to all of you .. I got it..Ajax is necessery for this kind of problems and its a modren day design approach.I will try to follow the same in my project also.