Please tell me its complete detail

Asked By 30 points N/A Posted on -
qa-featured

There are three different approaches in session tracking used in various technologies.

  1. Cookies
  2. URL Rewriting
  3. Hidden Fields.

And Java have provided with the session object,

You will explain the benefits of java session object over the above techniques.

SHARE
Best Answer by James20
Best Answer
Best Answer
Answered By 5 points N/A #96116

Please tell me its complete detail

qa-featured

Java provides an excellent solution to all the problems that occurred in tracking a session. The Servlet API provides several methods and classes specifically designed to handle session tracking. In other words, Servlets have built in session tracking.

As we all know there are three commonly used 'ways' of maintaining 'state' with the stateless HTTP protocol. Cookies, URL re-writing and hidden form fields in the HTML form. Session object or the session tracking API isolates the programmer from these implementation details.

Here are some benefits:

Easy implementation: Since the application server handles the implementation of HttpSession, the developer is freed from bothering with the details of designing, implementing, and testing code for managing session state.

High-quality, efficient operation: An application server's HttpSession implementation is optimized and tested for that server, and therefore will probably be more efficient and reliable than a custom solution.

Potentially richer feature set: An application server's implementation of session state management may include such features as failover, cluster support, and so on, that go beyond the base-level requirements of the J2EE platform specifications. The system architect can select a server platform with the differentiating features that best suit the application requirements, while maintaining J2EE technology compatibility and portability.

Scalability: When the application is allowed to manage session state by way of HttpSession, it can most effectively manage storage of that state in caches and/or server clusters.

Evolvability: Application server vendors are constantly improving their offerings. Servers will maintain existing interfaces for backward compatibility, even as they add features that improve performance and reliability. An HttpSession implementation that works properly today will work better tomorrow as improved server versions become available, with little or no change to the source code.

Answered By 0 points N/A #96117

Please tell me its complete detail

qa-featured

Hi,

I am explaining about JavaSession Object Benefits through following steps. 

Sessions are more secure and fast because they are stored at server side. But sessions have to be used combined with cookies (or) URLRewriting for maintaining client id that is session id at client side.

Hidden form Field

Hidden form fields are HTML input type that is not displayed when read by the browser. They are sent back to the server when the form that contains them is submitted. You include hidden form fields with HTML like this:

<FORM ACTION="/servlet/MovieFinder" METHOD="POST">

   <INPUT TYPE=hidden NAME="zip" VALUE="94040">

   <INPUT TYPE=hidden NAME="level" VALUE="expert">

</FORM>

In a sense, hidden form fields define constant variables for a form. To a servlet receiving a submitted form, there is no difference between a hidden field and a visible field. 

Cookies are store at client side so some clients may disable cookies so we may not sure that the cookies which we are maintaining may work or not, if cookies are disable also we can maintain sessions using URLRewriting.

In URLRewriting we cannot maintain large data because it leads to network traffic and access may be become slow. Where in sessions will not maintain the data which we have to maintain instead we will maintain only the session id.

Session: 

In Java the javax.servlet.http.HttpSession API handles many of the details of session tracking. It allows a session object to be created for each user session, then allows for values to be stored and retrieved for each session. A session object is created through the HttpServletRequest using the getSession()method: 

HttpSession session=request.getSession();

Related Questions