Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can I access java class using Ajax

 
deshki raja
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to implement chain selecting in a page..ie, selecting one option in a checkbox or dropdown will populate the options in the next dropdown...as in selecting country will display states options......... The options in second dropdown is stored in a java class......can i access this java class and retrieve the list of options using ajax....can any one help me on this ?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use Ajax to hit a servlet to fetch whatever you need.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
P.S. As I pointed out in this similar topic this is much easier with the assist of a library such as jQuery.

And, sample code is available. If you download the code for my jQuery book from its web page you'll find examples of creating dynamic dropdowns in the Chapter 8 sample code

You can see the sample code in action here.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic