0

I am stuck in a project in jsp itself. This is a servlet & jsp project. I have to display two text boxes in jsp page where one text box contains employee name & on the movement to 2nd text box (by onblur() of javascript)) his corresponding department should be displayed automatically. There are 2 tables named emp(emp_id,emp_name,dept_id(as foreign key)) and table dept(dept_id,dept_name). In 2nd text box dept_name should come automatically.

Help is appreciable. Thanking you.

Vinoth Krishnan
  • 2,925
  • 6
  • 29
  • 34
user1214683
  • 9
  • 1
  • 1
  • If two employees have same name but their departments are different then how can you search only using name , I mean you should be able to know the `emp_id` in order to get the right employee. – Aniket Kulkarni Jan 13 '14 at 07:12

1 Answers1

0

On onblur event write one function, use AJAX to call the servlet and pass the name of employee.
In servlet query the database and return the response back, display the response in the second textfield.

See also

Community
  • 1
  • 1
Aniket Kulkarni
  • 12,825
  • 9
  • 67
  • 90