Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to invalidate session?

 
narender kaasam
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to invalidate session?. What are techniques used?.
[ May 22, 2006: Message edited by: Bear Bibeault ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
 
geeta lalchandani
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to invalidate session?. What are techniques used?.


I guess you meant the ways...
session.invalidate is one
Other is you can specify the timeout in the web.xml.
 
Parameswaran Thangavel
Ranch Hand
Posts: 485
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I liked to put one point which i read some where,
The session wont get invalidated when the browser is closed, The session can be invalidated only through Time out property or Session.invalidate method.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64688
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is correct. The closing of a browser window has no direct effect upon the session.
 
Jeff Pollet
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Metaquestion:
I'm curious about something that I've seen quite often in the various forums: Oftentimes and 'answer' will be in the form of "Look at the API" or even "RTFM". This sort of answer confuses me, because, ultimately, it seems, just about any question could be answered by pouring over the API and trying out various things. One of the reasons that people come to these forums is that they have read the API and are unsure why something they're doing isn't working, or they simply don't 'get' the API for the particular thing they're trying to do.

Certainly, there are questioners who don't bother to look at the API--but I think it's more difficult to tell who they are than others seem to think. What use does "Look at the API" have, as an answer? Everybody knows there is an API, everybody knows that they could look at it--so saying 'look at it' is akin to saying 'that's a bad question'; in many cases, I don't think it is a bad question. If it is a bad question, it takes longer to say "Read the API" than to simply ignore the question. So what is the point?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64688
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeff Pollet:
Oftentimes and 'answer' will be in the form of "Look at the API" or even "RTFM". This sort of answer confuses me, because, ultimately, it seems, just about any question could be answered by pouring over the API and trying out various things.


I disagree. There are many questions that transcend the API, especially when it comes to techniques and patterns.

But simplistic question like "how do I trim a string?" or "how do I invalidate a session" are spelled out right there in the javadocs and it's not worth the time of the volunteers who help answer questions here to spend time on a question posed by someone who won't take the time to do even basic research on their own.


One of the reasons that people come to these forums is that they have read the API


Sadly, no.

Certainly, there are questioners who don't bother to look at the API--but I think it's more difficult to tell who they are than others seem to think.


Disagree again. I find them very easy to spot.

What use does "Look at the API" have, as an answer?


Two that I can think of: 1) It tells them that the answer is in the API should they bother to look, and 2) it tells them that JavaRanch is not a code mill or answer farm, but rather that it is a learning site. And learning how to use the javadoc is one of the most useful lessons that can be taught.

if it is a bad question, it takes longer to say "Read the API" than to simply ignore the question. So what is the point?


See (2) above.
[ May 22, 2006: Message edited by: Bear Bibeault ]
 
Jeff Pollet
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sadly, no.

Waitaminute. It's not even one of the reasons that people come to the forums, that they have read the API and don't understand it? That seems relatively unlikely. It's certainly one of the reasons that I have come askign for questions, so I'm at least one countrexample.

As far as letting people know that the forums aren't and answer farm (love that term), wouldn't ignoring their question have the same effect? Plus, I find it difficult to believe that the person who asked this question, for instance, didn't already know that the answer was in the API somewhere...and ignoring his question would have made it pretty clear that this isn't an answer farm.

I guess I'm probably spending too much time thinking about it. Just seems like those of us who might have read the API and just don't understand don't really deserve to be condescended to by pointing to it again...and I do think that in some cases it is intended to be condescending.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64688
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeff Pollet:

Waitaminute. It's not even one of the reasons that people come to the forums


Of course it is. My short reply was not meant to imply that everyone, not even a majority, of posters here don't do their "homework". Just look at some of the excellent threads that take place in this and the other forums. Rather, there are the few who either don't bother and expect others to do their work for them, or -- and this is probably most prevelant -- haven't yet learned how to learn.

For these folks, "please use the javadoc" is an appropriate response. By the way, you'll never see a rude "RTFM" here. If such a rude reply should be posted, someone will make it disappear before too long.

answer farm (love that term)


Thank you. I'll take credit for it.

wouldn't ignoring their question have the same effect?


Not always. For those that need to learn how to use the javadocs as a resource, a bit of direction will go a lot farther than the sound of crickets.

don't really deserve to be condescended to by pointing to it again


Did you find Ben's post condescending?
[ May 22, 2006: Message edited by: Bear Bibeault ]
 
Paul Clapham
Sheriff
Pie
Posts: 20949
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Everybody knows there is an API, everybody knows that they could look at it...
Actually, no. I have been answering Java questions here and elsewhere for quite a while and it's fairly obvious to me that there is a certain set of beginners who have no idea that there is a comprehensive set of documentation for the language. I have seen threads where people answer "Look at the documentation here" (with a link) and the response comes back "Thanks, I never knew that was there!"

And there are people who have no idea how to search the Internet. (Yes, choosing the right search keywords is a skill that not everybody has, especially people who don't speak English well and have to search for documents in English.) And there are people who want to write e-mail programs but have not the slightest idea of how e-mail over the Internet actually works. The list goes on; in all fields there are absolute beginners who don't even realize what they don't know.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've worked with plenty of platforms that don't have a documentation scheme that is as consistent and thorough as Java's Javadoc API.
I know that a lot of people come here not knowing about (or fully appreciating the value of) javadocs. The same goes for the Servlet and JSP specs. Because of this, I make a point not to repeat what's in them. I feel it's much more helpful to show newer Java developers, and maybe remind not so new Java developers, that they're there.

We've also compiled a lot of answers to the most commonly asked questions here into a FAQ. If I know the answer is in that FAQ, I'll make a point of linking to that instead of repeating what's already been written.

Personally, I don't think that was a bad question.
I also think that trying to point the original poster in the right direction by giving him a link to the documentation for the object in question is much more helpful than just ignoring him.

If you don't feel the same way, feel free to ignore as many threads as you like.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I must admit that I often say that the answer is written in the spec, or api.
Why ? Because I actually search for the answer myself, and what do I do first ? Check the specs ans the api.
And if the answer is there, no need to explain further, "It's written there".
I'm certainly not ignoring the poster's question, because I make sure that the answer is clearly written.
If the poster has already checked the same doc but still does not understand, I'll try to explain.

It's important to know that most of our problems can be solved by checking specs or apis.
It's also important to tell people to check them out, when they don't know that there are such valuable information.
 
narender kaasam
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello guys ,I didn't get answers exactly
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
- session.invalidate()
- specify the timeout in the web.xml
- session.setMaxInactiveInterval()
 
Jeff Pollet
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I think I stand corrected here, on several points. I appreciate the meta-input. The original poster sort of proved all y'all's point with his second post.

I didn't find Ben to be condescending in particular--I was questioning whether pointing to the docs was condescending as a general practice; but y'all have shown me the light. There are good reasons to do so. Thanks again for explaining it in better detail for me.

Also, as far as RTFM goes--I actually didn't even know what that acronym was until I read from a link in Ben's footer which used it:
How To Ask... But I acknowledge that I don't generally find that tone here.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeff Pollet:

Also, as far as RTFM goes--I actually didn't even know what that acronym was until I read from a link in Ben's footer which used it:
How To Ask... But I acknowledge that I don't generally find that tone here.


We have a more "ranche-like" version here:
http://faq.javaranch.com/view?HowToAskQuestionsOnJavaRanch

Even though the original is a bit more harsh, I still use that link because it is more comprehensive. If you can get past the tone and ego, the paper is actually quite informative; both for the asker and the askee.

Anyway, Jeff...
Welcome to the ranch.
Hope you stick around.
-Ben
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic