by Dinesh Thakur Category: Session

The form page prepared using .html file is called source form page (fixed content).The form page that comes as response generated by servlet or JSP program is called dynamic form page (dynamic content). Instead of asking all the details of end user in a single form page, it is recommended to ask those details in multiple form pages.

However, one big problem with it is that, the details entered in a particular form page cannot be accessed or retrieved in any other or even in the successive pages, because HTTP is a stateless protocol. This means every time a client sends a request a new connection is established and the previous request data lost. For example, in online shopping when we want to add a number of items to our cart, the online store's server have to make a record of the items which will be used during purchase. This is where session tracking comes to play. Session tracking is tracking of client data throughout the session and across the form pages.

Figure shows static form page that the end user needs to read and answer some unnecessary question, when he selects or deselects the marital status checkbox. To overcome the problem, the working with dynamic form page is shown.

In Figure the content of form page2 is dynamic and generated by Srv1 program based on the marital status value of ----- or request1 data.

All web applications are stateless web applications by default, which means ---- cannot remember client data across the multiple requests during a session.

                    Bad Designed Form Page

                     Working with Dynamic Form Page

A session is a set of continuous and related operations (requests) --- on the web application by a client (browser window / end user).

By stateless behavior of web application we mean that while processing current request in any web resource program, we cannot use previous request data, which means while processing request2 we cannot use request2 data as shown in Figure.

Web applications are stateless because the protocol http is given as stateless protocol. According to this, one new connection will be created between browser window and web server for every request and this connection will be closed automatically, once related response goes to the browser window.

Example

If browser window gives 10 requests to a web application, 10 connections will be created between browser window and web server. Due to this one connection related to a client's request data cannot be used in an other connection related to the client's request processing (that means we cannot use previous request data in web resource program while processing current request).

By placing <form> tag, <input> tag in pw.println( ) statements of servlet program we can generated dynamic form page from that servlet program. In naukri.com registration process multiple forms will be there. The first form page is static form page and other form pages are dynamic form pages. Based on the data given in form page1 the questions in form page2 will be rendered. Similarly, based on data in form page2 the questions in form page3 will be rendered.

Web applications are stateless because they are using a stateless protocol called.





About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.