Solved

Ajax with jsp and servlet

Posted on 2009-04-10
4
1,670 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
ID: 24121871
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
ID: 24137055
0
 
LVL 11

Assisted Solution

by:Manish
Manish earned 120 total points
ID: 24137066
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
ID: 24137556
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
jquery, dropdown 4 61
allswap challenge 6 96
java 8 lambda expresssions exception handling 3 89
HSSFWorkbook cannot be resolved error 10 68
Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
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.

776 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