• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp:useBean and scope

 
Allen Bandela
Ranch Hand
Posts: 128
Eclipse IDE MS IE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic