Q : In session created by server with client(browser) How
can server find that request coming is belong to new
session OR belong to session that is timeout.

Answer Posted / rajib

import javax.servelet.*;
public MyServelet extends HttpServelet{
public void doGet(HttpServeletRequest
req,HttpServeletResponse res)throws ServletException,IO
Exception{
res.setContentType("text/html");
PrintWriter out=res.getPrintWriter();
out.println("for trac session0");
HttpSession sess=req.getSession();
if(sess==null){
out.println(Old session not exist );
}else{
HttpSession session=request.getSession(true);
out.println("new Session Created.");
}}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can I run jsp on xampp?

559


What are the two types of comments supported by jsp?

590


Explain the difference between jspwriter and servlet printwriter in jsp?

592


How do we print “
creates a new line in html” in jsp?

753


What are the different scopes an object can have in a jsp page?

613






How do I run a jsp file in linux?

618


what are the tools used in your project , How to ask the answer this question

1670


Why jsp and servlets are used?

585


What are the jsp standard actions?

614


Differentiate between jsp scriptlet tag and declaration tag.

742


Is jsp a front end?

629


How can I override the jspdestroy() method within a jsp page?

589


How can I implement a thread-safe jsp page? What are the advantages and disadvantages of using it?

575


Why is _jspservice () method starting with an '_'?

533


What do you mean by jstl?

613