Feed another field (or pop-up a choice) in JSP when a field isentered a certain value

  • Thread starter Sébastien de Mapias
  • Start date
S

Sébastien de Mapias

Hi,

I've got to populate a 'City' textfield with a name when the user
enters a zipcode in 'Postal code'. I guess I'll use an 'onChange'
event, but I have to go to the database, retrieve the city (or
cities),
then if my reply contains more than one city I must offer to choose
it from a list... If there's only one city, I just have to go to the
'City'
field and fill it automatically with the value I've been returned.

I'm using Jakarta Struts 1.1 (quite old, I know...).

Any hints to give me for a good start ? 'Cause I'm very familiar with
this Jsp technology actually... I really don't know how to address
this.

Thanks a lot in advance.
Regards,
Sébastien
 
D

Dave Miller

Sébastien de Mapias said:
Hi,

I've got to populate a 'City' textfield with a name when the user
enters a zipcode in 'Postal code'. I guess I'll use an 'onChange'
event, but I have to go to the database, retrieve the city (or
cities),
then if my reply contains more than one city I must offer to choose
it from a list... If there's only one city, I just have to go to the
'City'
field and fill it automatically with the value I've been returned.

I'm using Jakarta Struts 1.1 (quite old, I know...).

Any hints to give me for a good start ? 'Cause I'm very familiar with
this Jsp technology actually... I really don't know how to address
this.

Thanks a lot in advance.
Regards,
Sébastien

Use ajax:

http://java.sun.com/developer/technicalArticles/J2EE/AJAX/
 
G

gundsawada

Hi,

I've got to populate a 'City' textfield with a name when the user
enters a zipcode in 'Postal code'. I guess I'll use an 'onChange'
event, but I have to go to the database, retrieve the city (or
cities),
then if my reply contains more than one city I must offer to choose
it from a list... If there's only one city, I just have to go to the
'City'
field and fill it automatically with the value I've been returned.

I'm using Jakarta Struts 1.1 (quite old, I know...).

Any hints to give me for a good start ? 'Cause I'm very familiar with
this Jsp technology actually... I really don't know how to address
this.

Thanks a lot in advance.
Regards,
Sébastien

To be more specific, google 'Ajax' and 'AutoComplete'
 
S

Sébastien de Mapias

Any hints to give me for a good start ? 'Cause I'm very familiar with

Oops, "I'm *NOT* very familiar" I meant...
 
D

Dave Miller

Sébastien de Mapias said:
Oops, "I'm *NOT* very familiar" I meant...
A JSP is running on the server. When the user and his browser connect to
the server the JSP provides it's data back to the browser.

When the user types into a form, the action is taking place on the
user's computer - the server and the JSP are out of the loop. Action
from the client side is needed to connect again with the server.

Ajax runs within the browser on the user's computer. It can react to
input on your form to get data from the server and display it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top