tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hlista, Brad" <bhli...@vignette.com>
Subject <jsp:useBean> instantiation performance
Date Thu, 21 Sep 2000 17:06:05 GMT
in the 4.2.1 section of the JSP1.2 Spec PD1, the 
<jsp:useBean> is discussed.  

as i read this, generally an implementation should 
be calling 'new' for bean creation unless beanName is
given in <jsp:useBean>.  the alternative of using
Beans.instantiate() to create an instance 
is quite slow in comparison. (3.6 seconds for 10,000
bean instantiations vs. 3.6 seconds for 4,700,000 on
a dual pentium 550 (one processor being used))

is this a correct reading of the spec?

should it or has it been considered?

i'm not sure if this has been addressed.  i've looked
around and did not see a mention of it in the archives.

thanks,
brad

from the Spec:

5. If the object is not found in the specified scope; and the class
specified names a non-abstract
class that defines a public no-args constructor, then that class is
instantiated, and
the new object reference is associated the with the scripting variable and
with the
specified name in the specified scope using the appropriate scope dependent
association
mechanism (see PageContext). After this, step 7 is performed.
If the object is not found, and the class is either abstract, an interface,
or no public
no-args constructor is defined therein, then a
java.lang.InstantiationException shall occur. This completes the processing
of this useBean action.

6. If the object is not found in the specified scope; and beanName is given,
then the method
instantiate() of java.beans.Beans will be invoked with the ClassLoader of
the
Servlet object and the beanName as arguments. If the method succeeds, the
new object
reference is associated the with the scripting variable and with the
specified name in the
specified scope using the appropriate scope dependent association mechanism
(see
PageContext). After this, step 7 is performed.

7. If the jsp:useBean element has a non-empty body, the body is processed.
The variable
is initialized and available within the scope of the body. The text of the
body is treated as
elsewhere; if there is template text it will be passed through to the out
stream; scriptlets
and action tags will be evaluated. 

Mime
View raw message