You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Hunter Hillegas <li...@lastonepicked.com> on 2001/10/02 16:45:17 UTC

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?

Hunter



Re: Using Reflection in Tags? Good?

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Tue, 2 Oct 2001, Hunter Hillegas wrote:

> Date: Tue, 02 Oct 2001 07:45:17 -0700
> From: Hunter Hillegas <li...@lastonepicked.com>
> Reply-To: tomcat-user@jakarta.apache.org
> To: Tomcat User List <to...@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