Hello
The sendRedirect method sends a response back to the client browser with a
special header that instructs the *browser* to make a *new* request to
whatever URL you have specified - usually back to your server, but it can be
to anywhere.
The forward method is quite different: it 'calls' another resource in your
server to take over the processing of the current request. You can think of
forwarding as if you are calling another method to continue processing the
request that the servlet started processing.
At some point, the other resource should, of course, send a response back to
the client browser.
To clear an existing session and start a new one, try:
HttpSession session = request.getSession( false );
If ( session != null ) {
session.invalidate();
session = request.getSession( true )
}
// then add your attributes here...
Calling 'request.getSession( false )' will *not* create a new session, but
will return an existing one if there is one already there.
Good luck.
Harry Mantheakis
London, UK
> 1) What is the differences between two ?
> res.sendRedirect("http://localhost:8080/authendication/Logout/body_logout.jsp"
> );
> or
> getServletContext().getRequestDispatcher("/authendication/Logout/body_logout.j
> sp").forward(req, res);
>
> 2) 1 )Whenever for the first time if the user enters, I want to store the
> username,rights in the session How to do it in Servlet. Is it right ?
>
> HttpSession session = request.getSession(true); //can u tell me when we have
> keep false here.
> session.setAttribute("username",usernamevalue);
> session.setAttribute("rights",rights");
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free web site building tool. Try it!
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]