tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: Using Reflection in Tags? Good?
Date Tue, 02 Oct 2001 16:28:57 GMT


On Tue, 2 Oct 2001, Hunter Hillegas wrote:

> Date: Tue, 02 Oct 2001 07:45:17 -0700
> From: Hunter Hillegas <lists@lastonepicked.com>
> Reply-To: tomcat-user@jakarta.apache.org
> To: Tomcat User List <tomcat-user@jakarta.apache.org>
> Subject: Using Reflection in Tags? Good?
>
> I have the Manning book, "JSP Tag Libraries" which I've been using to help
> develop some of my first tags.
>
> For their iterator tags that work with beans, they use a lot of reflection.
> I've not used reflection much in projects before this but I seem to remember
> from my education that reflection is a very expensive process...
>
> Anyone that has worked with tags have any insight as to how this design
> could negatively impact performance on the Web app?
>

With modern JVMs, the cost of reflection is nearing zero.  Compared to
network and database latency, you'll usually never see the small amount of
extra compute time required for reflection.  And you'll really like all
the freedom and flexibility it gives you.

For an interesting use of reflection, check out how the Struts Framework
uses it to populate JavaBeans properties of ActionForm beans:

  http://jakarta.apache.org/struts/

Struts uses a small class library called "BeanUtils" underneath, which is
also available to you separately through the Jakarta Commons project:

  http://jakarta.apache.org/commons/

> Hunter
>

Craig


Mime
View raw message