Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Building dynamic web forms with servlets

Reply
Thread Tools

Building dynamic web forms with servlets

 
 
Damo_Suzuki
Guest
Posts: n/a
 
      02-16-2007
HI,
I have a form that generates a HTML form. In the form I have a select
list with a few options. When one of the options is selected I want to
the form to generate another select box beside the original one.

Say, I have a select box with a list of countries in it. Then , when
the user selects a country, another select box appears containing the
cities in the selected country. I want it to happen without reloading
the entire page.

Is this possible with servlets? Can someone point me in the right
direction

Thanks

 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      02-16-2007
Damo_Suzuki wrote:
> HI,
> I have a form that generates a HTML form. In the form I have a select
> list with a few options. When one of the options is selected I want to
> the form to generate another select box beside the original one.
>
> Say, I have a select box with a list of countries in it. Then , when
> the user selects a country, another select box appears containing the
> cities in the selected country. I want it to happen without reloading
> the entire page.
>
> Is this possible with servlets? Can someone point me in the right
> direction


Servlets run on the server. The only way to invoke them is via a round-trip to
the server. You can make this more convenient for the user with Javascript
(AJAX) to handle the request and response under the hood.

There are tricks for dividing a page into independently updated parts, but
they are not really needed unless you have a very thick page and a very slow
connection. If you can design your page to be rather lean, then just go ahead
and reload the entire page.

Sometimes you phrase a question to yourself in terms of a particular strategy,
"How can I avoid a page reload?", which limits your options and blinds you to
costs. (Segmenting a page is more complex than showing a "normal" HTML page.)
It is useful to step back and ask yourself the question in terms of a goal,
"How can I make a smooth user experience?" Note that the first question is
computer-centric, the second human-centric.

- Lew
 
Reply With Quote
 
 
 
 
=?ISO-8859-1?Q?Arne_Vajh=F8j?=
Guest
Posts: n/a
 
      02-17-2007
Lew wrote:
> Damo_Suzuki wrote:
>> I have a form that generates a HTML form. In the form I have a select
>> list with a few options. When one of the options is selected I want to
>> the form to generate another select box beside the original one.
>>
>> Say, I have a select box with a list of countries in it. Then , when
>> the user selects a country, another select box appears containing the
>> cities in the selected country. I want it to happen without reloading
>> the entire page.
>>
>> Is this possible with servlets? Can someone point me in the right
>> direction

>
> Servlets run on the server. The only way to invoke them is via a
> round-trip to the server. You can make this more convenient for the user
> with Javascript (AJAX) to handle the request and response under the hood.


More than that.

This is a textbook AJAX example.

Almost the hello world of AJAX.

Arne
 
Reply With Quote
 
murari garg
Guest
Posts: n/a
 
      02-17-2007
On Feb 16, 6:45 pm, "Damo_Suzuki" <(E-Mail Removed)> wrote:
> HI,
> I have a form that generates a HTML form. In the form I have a select
> list with a few options. When one of the options is selected I want to
> the form to generate another select box beside the original one.
>
> Say, I have a select box with a list of countries in it. Then , when
> the user selects a country, another select box appears containing the
> cities in the selected country. I want it to happen without reloading
> the entire page.
>
> Is this possible with servlets? Can someone point me in the right
> direction
>
> Thanks


hi
i think if you do same programme in JSP and in jsp page you utilize
action listener and in listener will act after user will going to
select your first option.and by threading your programme will going to
other option to user.

 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      02-17-2007
murari garg wrote:
> i think if you do same programme in JSP and in jsp page you utilize
> action listener and in listener will act after user will going to
> select your first option.and by threading your programme will going to
> other option to user.


Web applications should do no explicit multithreading, beyond making the code
thread-safe.

- Lew
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Java servlets: Hi All! I want to display xml file in browser using servlets datta.saru Software 0 05-15-2006 03:30 PM
forms authentication -- expired forms cookie vs. not provided forms cookie Eric ASP .Net Security 2 01-27-2006 10:09 PM
building dynamic list of web from controls =?Utf-8?B?c2NvdHRybQ==?= ASP .Net 12 04-28-2005 10:57 AM
Any help regarding the building of a Web Forms Designer Surface? =?Utf-8?B?QWFtaXIgSXNsYW0=?= ASP .Net 0 04-07-2004 12:01 PM
Building to Building wireless Patriot Cisco 2 11-04-2003 05:07 PM



Advertisments