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

How do you prevent the creation of a session in a jsp page and why? What is the difference between include directive & jsp:include action?

743


How many jsp implicit objects are there?

698


What do you know about jsp expression language (jsp expression language – el)?

707


Which tag is used for error handling in jsp pages?

606


How does a jsp function?

672


Why is it not recommended to use script elements in jsp?

662


What are directives? What are the different types of directives available in jsp?

674


Explain the advantages in jsp?

737


Can I use javascript on jsp page?

668


What is difference between jspwriter and servlet printwriter?

715


What is tld in jsp?

656


What is jsp in javascript?

673


How can we disable el?

688


What does jsp mean in text?

645


What is a hidden comment in jsp?

676