Solved

Ajax with jsp and servlet

Posted on 2009-04-10
4
1,668 Views
Last Modified: 2013-11-24
Hi,

I have a jsp which as customer names in a select box. Now when a customer selects any of the customer names, his app details will be populated in another box using his cust id. Now in the first select box i have customer name, so how do i fetch records from mysql in servlet using the customer name. is it that first i need to fetch customer id based on selection and then populate the app id. Also i want to know how to tell ajax that this is the customer i have selected.
0
Comment
Question by:SunScreenCert
  • 2
4 Comments
 
LVL 19

Assisted Solution

by:Kuldeepchaturvedi
Kuldeepchaturvedi earned 60 total points
Comment Utility
that shd be fairly easy...

put a javascript on your select box 'onSelect' event..

from this java script make an AJAX call to another jsp which will accept the Customer id ( you will pass it by appending to the url like ...yourjsp.jsp?id=custid...


in the jsp make the connection to the mysql database, get the required values from dbase and then send the details back to your calling jsp..

get the data and show it on HTML...

get some skeleton code along these lines and experts here will help you get it working.
0
 
LVL 11

Assisted Solution

by:Manish
Manish earned 120 total points
Comment Utility
0
 
LVL 11

Assisted Solution

by:Manish
Manish earned 120 total points
Comment Utility
If ajax is not there, how your going to send this information,
same way u can send using ajax.
0
 
LVL 12

Accepted Solution

by:
Gibu George earned 70 total points
Comment Utility
http://www.ics.uci.edu/~cs122b/projects/project5/AJAX-JSPExample.html

This is a simple ajax jsp example go through it. Step #5 shows the serverside code, this you need to change according to your needs.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Hello World !, Thanks : My Sincere thanks to @Michael Male who encouraged me to write an article on this in my  blog (http://scribblejava.wordpress.com). Introduction:       There are several technical issues a developer may face in his…
ASP.NET AJAX callbacks to web service are becoming very popular and unavoidable these days. The feel that the user gets when only a part of the page is updated without even hindering the UI is the advantage that the callbacks offer. The wait for the…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now