• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sendRedirect()

 
VENKATESH NADAGOUDA
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does using sendRedirect() end a session, if so how to retain the same session
 
boyet silverio
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no, it does not.
 
Mark Howard
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Venkatesh
A session is started when the first request is received from a client, and ends when the same client explicitly ends the session or the server does not receive any further requests from the client for a certain period of time (which can be configured in the web.xml file). The servlet itself can also invalidate a session itself using HttpSession.invalidate().
sendRedirect() merely directs the client to another resource. It does commit the response to the client, but it does not end the session itself.
[ January 29, 2003: Message edited by: mark howard ]
 
VENKATESH NADAGOUDA
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can we use pageContext.getOut().print("Hi") in doAfterBody() method.
 
VENKATESH NADAGOUDA
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Howard and Boyet
 
Sudd Ghosh
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Venkatesh -
Yes, in the doAfterBody() method you can use the getOut() method on the PageContext object that you've already saved using the setPageContext(). Pls note you don't have the implicit variable pageContext available in the tag handler class. It seems whatever you can do in doStartTag() can be done in doAfterBody(), however in the case when some body-content is present, the calling sequence will differ.
Thanks, Sudd
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic