File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes javascript function calling a servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "javascript function calling a servlet" Watch "javascript function calling a servlet" New topic
Author

javascript function calling a servlet

Stuart Rogers
Ranch Hand

Joined: Oct 02, 2008
Posts: 134
Greetings all,

I've crafted a jsp at http://www.purplelizardgallerycom/show_project_directories.jsp

which contains an <jsp:include "foobar"/> to build the select box,
followed by a button to call a javascript function , followed by an
<div id="clistgoeshere">

Clicking the button triggers the function, which grabs the value picked in the select box and displays it in <div id="clistgoeshere">.

So far so good.

I have a servlet "bohica" that returns some content.

How can I modify the javascript function to call the servlet (something like bohica( projpicked) ) AND have the resulting content displayed in <div id="clistgoeshere"> ?

TIA,

Stuart
Satish Chilukuri
Ranch Hand

Joined: Jun 23, 2005
Posts: 266
What you need is an AJAX call.
Stuart Rogers
Ranch Hand

Joined: Oct 02, 2008
Posts: 134
By Jove you are correct! Yes this Ajax stuff looks like just the secret sauce I need.

Thanks,

Stuart
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61008
    
  65

Do yourself a favor and, after you familiarize yourself with how Ajax works, adopt a library such as jQuery to handle your Ajax calls for you.

Your hair will thank you.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
wood burning stoves
 
subject: javascript function calling a servlet