[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1678
  • Last Modified:

Ajax with jsp and servlet

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
SunScreenCert
Asked:
SunScreenCert
  • 2
4 Solutions
 
KuldeepchaturvediCommented:
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
 
ManishLeadCommented:
0
 
ManishLeadCommented:
If ajax is not there, how your going to send this information,
same way u can send using ajax.
0
 
Gibu GeorgeCTOCommented:
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now