Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Jsp equivalent code for asp code-->response. isClient Connected()

 
Sushil Suvarna
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please give me the Jsp equivalent code for the asp code
-->
response.isClientConnected()
 
Ali Gohar
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does it do?
 
Rishi Tandon
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sushil ,

whenever a client places a request to servlet/JSP. The connection breaks after the response is sent by the Servlet/JSP, though session is maintained by the server.

Now we can check whether the session is valid for that particular client by using request.isRequestedSessionIdValid().

- Rishi
 
Gert Cuppens
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I understand it well, you mean you want to know whether the session of the client is valid. I've made an application which works woth sessions. First, I oblige the user to log in.
I start a session with
HttpSession session = _request.getSession(true);
The boolean true means Java must create a session if there hasn't been created a session before.
Later on, in the application, my controller checks if there is a session.
Here's a piece of the code
HttpSession session = _request.getSession(false);
if (session == null) requestedPage = LOGIN_PAGE;
else if (viewNaam.equalsIgnoreCase(LOGIN_PAGE))
requestedPage = behandelLogin(_request, _response);

With boolean false I don't create a session if there isn't one. And if the session turns out to be null, I make the user log in.
I suppose this way I'm checking whether the session is valid.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!