Solved

Ajax with jsp and servlet

Posted on 2009-04-10
4
1,674 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Turn Insights Into Action

You’ve already invested in ITSM tools, chat applications, automation utilities, and more. Fortify these solutions with intelligent communications so you can drive business processes forward.

With xMatters, you'll never miss a beat.

Question has a verified solution.

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

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…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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.

691 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