dcsimg

What effect on variables does the keyword 'static' have when used in the declaration section of a JSP Page?

Prasad Thammineni

The use of 'static' keyword in the declaration section of a JSP page has the same effect as that of declaring a static variable in a Java Class. Its value is shared by all instances of the class. In this case all instances of the servlet equivalent of the JSP. Since servlets have only one instance (when not implementing the SingleThreadModel interface) that is shared among multiple web users, it is similar to declaring a non-static variable in the declaration section.