Building dynamic web forms with servlets

Discussion in 'Java' started by Damo_Suzuki, Feb 16, 2007.

  1. Damo_Suzuki

    Damo_Suzuki Guest

    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
     
    Damo_Suzuki, Feb 16, 2007
    #1
    1. Advertising

  2. Damo_Suzuki

    Lew Guest

    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
     
    Lew, Feb 16, 2007
    #2
    1. Advertising

  3. 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
     
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=, Feb 17, 2007
    #3
  4. Damo_Suzuki

    murari garg Guest

    On Feb 16, 6:45 pm, "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
    >
    > 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.
     
    murari garg, Feb 17, 2007
    #4
  5. Damo_Suzuki

    Lew Guest

    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
     
    Lew, Feb 17, 2007
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?QWFtaXIgSXNsYW0=?=

    Any help regarding the building of a Web Forms Designer Surface?

    =?Utf-8?B?QWFtaXIgSXNsYW0=?=, Apr 7, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    366
    =?Utf-8?B?QWFtaXIgSXNsYW0=?=
    Apr 7, 2004
  2. =?Utf-8?B?c2NvdHRybQ==?=

    building dynamic list of web from controls

    =?Utf-8?B?c2NvdHRybQ==?=, Apr 18, 2005, in forum: ASP .Net
    Replies:
    12
    Views:
    666
    Steven Cheng[MSFT]
    Apr 28, 2005
  3. Jim
    Replies:
    2
    Views:
    872
  4. Midex
    Replies:
    24
    Views:
    921
  5. Eric
    Replies:
    2
    Views:
    558
Loading...

Share This Page