I have small question, can we declare variable at class level ?
Generally in servlets we don't declare instance variables.
Is the samething applies to Portlets. I am little confused. Portlets are based on portletrequest & response, not on HttpRequest and HttpResponse.
Should we not declare instance variables for portlets ? Can someone who has clear understanding explain it.
I will really appreciate your help
posted 5 years ago
Your understanding is correct - portlets are like servlets and you should not declare instance variables in the portlet class. The reason is the same as in case of servlets - multiple threads might be accessing the same portlet instance.