|Home |Login |Registration |Struts Step by Step Tutorial |Hibernate Step by Step Tutorial |Spring Step by Step Tutorial |JSP Step by Step Tutorial |JDBC Step by Step Tutorial |Web Services Step by Step Tutorial |EJB fundamentals | ORACLE Step by Step Tutorial | SCJP 5.0 and SCJP 6.0 Study Guide | SCWCD 5.0 Study Guide | SCJP Tips
Java mock test | SCJP mock test | SCJP DUMP | SCBCD mock test |Java online test exam | JSP online test | ORACLE online test | Hibernate online test | Servlet online test | Struts online test | EJB online test | C online test | C++ online test | Aptitude online test

Java interview questions | JSP interview questions | ORACLE interview questions | Hibernate interview questions | Servlet interview questions | Struts interview questions | JDBC interview questions | C/C++ interview questions | Spring interview questions | JMS interview questions | Informatica interview questions | EJB interview questions | OOPS and Design Pattern interview questions
1600 PMP mock questions 1400 CAPM mock questions 800 SCJP 6 mock questions 600 OCAJP 7 mock questions 590 OCPJP 7 mock questions 556 SCWCD 5 mock questions 500 OCEJWCD 6 mock questions pdfDownload (java,struts, hibernet etc) JobsJobs and Walkins

 

Recent Questions

!!! JSP Frequently Asked Questions !!!

Q.How you do Session Management in JSP ?

SCWCD 1.5 Exam Kit

!!!Answer!!!- From Technical Expert

Http protocol is a stateless protocol, that means that it can't persist the data. Http treats each request as a new request so every time you will send a request you will be considered as a new user.

In session management whenever a request comes for any resource, a unique token is generated by the server and transmitted to the client by the response object and stored on the client machine as a cookie. We can also say that the process of managing the state of a web based client is through the use of session IDs. Session IDs are used to uniquely identify a client browser, while the server side processes are used to associate the session ID with a level of access. Thus, once a client has successfully authenticated to the web applicatiion, the session ID can be used as a stored authentication voucher so that the client does not have to retype their login information with each page request. Now whenever a request goes from this client again the ID or token will also be passed through the request object so that the server can understand from where the request is coming.
Session management can be achieved by :

1. Cookies: cookies are small bits of textual information that a web server sends to a browser and that browsers returns the cookie when it visits the same site again. In cookie the information is stored in the form of a name, value pair. By default the cookie is generated. If the user doesn't want to use cookies then it can disable them browser setting.

2. URL rewriting: In URL rewriting we append some extra information on the end of each URL that identifies the session. This URL rewriting can be used where a cookie is disabled. It is a good practice to use URL rewriting. In this session ID information is embedded in the URL, which is recieved by the application through Http GET requests when the client clicks on the links embedded with a page.
Exmaple : http://www.techfaq360.com/answers.jsp?sname=test

3. Hidden form fields: In hidden form fields the html entry will be like this : <input type ="hidden" name ="name" value="">. This means that when you submit the form, the specified name and value will be get included in get or post method. In this session ID information would be embedded within the form as a hidden field and submitted with the Http POST method.

4. HttpSession object :
javax.servlet.http.HttpSession is an interface that provides a way to identify a user across more than one page request or visit to a web site. This is the way mainly used in webapplication. HttpSession object maintain session for you. You don't need to do any session management.

session.setAttribute("name",name);
String name = session.getAttribute("name");
you will get the same value which you have set.


Answered By : null Replied Date : Apr 4 2012
Answer :


Answered By : null Replied Date : Feb 15 2012
Answer :


Answered By : null Replied Date : Dec 9 2011
Answer :


Answered By : null Replied Date : Dec 3 2011
Answer :


Answered By : null Replied Date : Nov 4 2011
Answer :


Answered By : null Replied Date : Aug 10 2011
Answer :


Answered By : null Replied Date : Jul 16 2011
Answer :


Answered By : null Replied Date : Jun 19 2011
Answer :


Answered By : null Replied Date : Jun 3 2011
Answer :


Answered By : null Replied Date : Apr 30 2011
Answer :


Answered By : null Replied Date : Apr 21 2011
Answer :


Answered By : null Replied Date : Apr 21 2011
Answer :


Answered By : null Replied Date : Apr 8 2011
Answer :


Answered By : null Replied Date : Apr 8 2011
Answer :


Answered By : null Replied Date : Apr 8 2011
Answer :


Answered By : null Replied Date : Apr 5 2011
Answer :


Answered By : null Replied Date : Apr 4 2011
Answer :


Answered By : null Replied Date : Apr 1 2011
Answer :


Answered By : null Replied Date : Apr 1 2011
Answer :


Answered By : null Replied Date : Apr 1 2011
Answer :


Answered By : null Replied Date : Feb 9 2011
Answer :


Answered By : null Replied Date : Jan 16 2011
Answer :


Answered By : null Replied Date : Jan 15 2011
Answer :


Answered By : null Replied Date : Jan 14 2011
Answer :


Answered By : null Replied Date : Dec 24 2010
Answer :


Answered By : null Replied Date : Dec 23 2010
Answer :


Answered By : null Replied Date : Dec 23 2010
Answer :


Answered By : null Replied Date : Dec 12 2010
Answer :


Answered By : null Replied Date : Nov 27 2010
Answer :


Answered By : null Replied Date : Nov 19 2010
Answer :


Answered By : null Replied Date : Nov 6 2010
Answer :


Answered By : null Replied Date : Aug 27 2010
Answer :


Answered By : null Replied Date : Aug 14 2010
Answer :


Answered By : null Replied Date : Aug 9 2010
Answer :


Answered By : null Replied Date : Jun 2 2012
Answer :


Answered By : null Replied Date : Jul 14 2012
Answer :


Answered By : null Replied Date : Aug 22 2012
Answer :


Answered By : null Replied Date : Aug 26 2012
Answer :


Answered By : null Replied Date : Oct 10 2012
Answer :


Answered By : null Replied Date : Dec 30 2012
Answer :


Answered By : null Replied Date : Jan 2 2013
Answer :


Answered By : null Replied Date : Jan 17 2013
Answer :


Answered By : null Replied Date : Feb 3 2013
Answer :


Answered By : null Replied Date : Mar 4 2013
Answer :


Answered By : null Replied Date : Mar 8 2013
Answer :


 

You can also contribute to this answer:

Your Name:
Answer:

 
Ask Question and get answer from Expert.
View Answers List from Expert.

The information you are posting should be related to java and ORACLE technology. Not political.