File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ajax dynamic combo

 
sridhar anna
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://mywelt.net/?q=node/4020

Eric
 
sridhar anna
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • 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
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic