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

Why use of scripting elements in jsp is discouraged?

542


Mention the jstl core tags.

527


What are the different types of jsp tags?

477


Can you explain what is jsp page life cycle?

525


Is jsp server side scripting language?

568






Why do we need servlets and jsp?

474


What is asp and jsp?

497


difference betwwn 16 bit and 32 bit

1705


How to delete a cookie in jsp?

536


What is jsp and why it is used?

449


Can Static method be Override?

546


What is jsp custom tag and what are it’s components?

518


What are the advantages of jsp over servlet?

499


Can a constructor be used in place of init() method to initialize a servlet?

493


What is jsp taglib?

503