• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ajax dynamic combo

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

In a jsp page, I want to create two dynamic combo drop down menus, like you select a make of a car in one box and you can get all the available models in the other box. I do not want the page to refresh. I looked up dwr at http://getahead.ltd.uk/dwr/examples but I am still not clear on how to get going.

Can anyone give me an example or point me in a direction.

Thanks,
Sridhara
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://mywelt.net/?q=node/4020

Eric
 
sridhar anna
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Eric,

Thank you for the sample chapter. I have a question - In Listing 4: DoubleComboXML.aspx.vb: Server-side creation of the XML response, how would I do the same in a jsp page?

Thanks again,
Sridhara.
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You just dynamically create the XML document as it suggest.

Grab the values from the posted form.
Generate your SQL statement
Loop though the results
Build the document as a big string
and write it to the page when done

Is there something you are confused about? Examples of generating xml with jsp is here

Eric
 
sridhar anna
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Eric,

I have some questions regarding the sample chapter.

From Listing 9.2:
var loader1 = new net.ContentLoader(url,FillDropDown,null,"POST",strParams);
Question 1 - Where are you using the variable loader1?
Question 2 - For the url you had mentioned DoubleComboXML.aspx. If I write a servlet, what would the url be? And how can I interact with the webpage?

Thank You so much,
Sridhara.
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to download the source code to get the js file that has the loader in it. You are looking for net.js

http://www.manning.com/books/crane/source

You can call the servlet. Look at this for another explaination:
https://bpcatalog.dev.java.net/nonav/ajax/ajax.html

Eric
 
sridhar anna
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Eric,

Thanks for the article(https://bpcatalog.dev.java.net/nonav/ajax/ajax.html). Its more clear now.

Sridhara.
--
 
sridhar anna
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I have two drop down menus where if the user selects from the first drop down menu, i am using ajax, and querying the database and populating the second drop down menu. Now when the user makes a selection from the second drop down menu and clicks on a submit button, I use the values selected from the first and second drop down menus, and reload the page to generate a report on the same page. Here, after the page reloads, the second drop down menu is becoming empty. How can I retain the values in the second drop down menu with the user selection as "selected". Please advise.

Thanks in advance.
Sridhara.
[ February 20, 2006: Message edited by: sridhar anna ]
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to have the serverside code realize that there was data in the field and have it put it back in. Or a worse way is try to do it with an ajax method.

Eric
 
sridhar anna
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Eric Pascarello:
You need to have the serverside code realize that there was data in the field and have it put it back in. Or a worse way is try to do it with an ajax method.



Can you kindly explain the worse way.

Thanks.
 
reply
    Bookmark Topic Watch Topic
  • New Topic