Why http is a stateless protocol ?, JAVA Programming

 

The "http protocol" is a stateless response or request based protocol.

You may contain the state information between different page requests as given below:

HTTP Sessions are the recommended useful approach. A session finds the requests that originate from the same browser in the mean while the period of conversation. All the servlets may share the similar session. The JSESSIONID is started by the server and may be passed to client through URL re-writing (if cookies are turned off), cookies or built-in SSL process.   Care could be given to minimize size of objects stored in session and objects stored in session could be serializable. In a Java servlet the session may be retrieve as given:

 

HttpSession session = request.getSession(true); //gives a current session or a new session

//To get/put a value in/from the session

Name name = new Name("Parker");

session.setAttribute("lastname", name); //session.putValue(...) is deprecated as of 2.2

session.getAttribute("lastname");//get a value. session.getValue(...) is deprecated

//If a session is no longer needed e.g. user has logged out, etc then it may be invalidated. session.invalidate();

//you may also set the session inactivity lease period on every session basis session.setMaxInactiveInterval(300);

 

 

1079_Untitled.png

Posted Date: 7/25/2012 3:53:24 AM | Location : United States







Related Discussions:- Why http is a stateless protocol ?, Assignment Help, Ask Question on Why http is a stateless protocol ?, Get Answer, Expert's Help, Why http is a stateless protocol ? Discussions

Write discussion on Why http is a stateless protocol ?
Your posts are moderated
Related Questions
The SwitchAction class gives a means to switch from a resource in one module to another resource in a dissimilar module. SwitchAction is useful only if you have multiple modules in

Operator Functionality E x ample/Explanation = Sets one value equal to another counter=0  Sets the counter to equivale

Write the JavaScript code for the Function SumOddNumbers(maxNumber) in which can add non-negative odd numbers up to maxNumber and return their sum. Java Script Code

The Applet's life cycle functions are as follows: public void init() : Initialization function called only once by the browser. public void start() : Method called after

Find representative skyline points in to two dimensional data Project Description: Run skyline algorithm run representative skyline algorithm up to skyline algorithm (Affi

A one page website where a user can input the information including Company Name, Title, Activity, R/S, I also need the user to select the start date, end date, and check poi

A fictitious train company, 'Transrail', has commissioned you to write a program that manages a list of train tickets. The program should display a text menu that prompts the us

Write a program to perform multiplication and division in java? Of course Java could also do multiplication and division. Because most keyboards don't have the times and divisi

To integrate your Struts application with Spring, we have two options: ? Configure Spring to manage your Actions as beans, using the ContextLoaderPlugin, and set their dependenc

How to Scaling Images in java applet? You can scale an image within a particular rectangle using this version of the drawImage() method: public boolean drawImage(Image img,