portlet class variable
http://wpcertification.blogspot.com/2009/03/understanding-standard-portlet-life.html
at this page there is a sentence like: "The Portal server will create only one instance of portlet per JVM"
What does it mean? Is it means that; if i use class variable in my portlet, all users will use the same values?
I have a problem like this. I am keeping page number of a jsp page, in a class variable. And if my friend open this pag开发者_StackOverflow中文版e with his computer, he always seeing the same page with me!!!
Any ideas?
Portlets (like servlets) can service multiple requests concurrently. They are scoped to the application and should be threadsafe.
You should not use member variables for per-user state. Request scope data should be held in the request (or possibly as render parameters). If you want user data to persist across requests, you should use the session.
精彩评论