If a bean already exists, will jsp:useBean use it regardless of the scope in which it is present? or will it use the bean only if it is present in the scope specified by its scope attribute. Because I have a jsp page which I am trying to analyze for performance, its part of a whole project which I do not have access to. I want to know if the bean used by this jsp through its <jsp:useBean> is the same bean used by the rest of the project. Thanks.
The container should treat beans with the same name but bound to different scopes differently. I know that in Tomcat version 5.0.28, this was not the case. In that version, the jsp.getProperty tags used the same mechanism for finding scoped variables that EL expressions would (search all scopes for the object with the given name).
This was tightened up in later versions.
You may want to do some testing before relying on this behavior in your own app.