Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2007

Tip: Looking for answers? Try searching our database.

Building dynamic web forms with servlets

Thread view: 
Damo_Suzuki - 16 Feb 2007 13:45 GMT
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
Lew - 16 Feb 2007 15:02 GMT
> HI,
> I have a form that generates a HTML form. In the form I have a select
[quoted text clipped - 8 lines]
> 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
Arne Vajhøj - 17 Feb 2007 00:34 GMT
>> 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
[quoted text clipped - 11 lines]
> 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
murari garg - 17 Feb 2007 16:42 GMT
> HI,
> I have a form that generates a HTML form. In the form I have a select
[quoted text clipped - 10 lines]
>
> 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.
Lew - 17 Feb 2007 17:05 GMT
> 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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.