You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ted Husted <te...@husted.com> on 2002/06/04 13:08:49 UTC

Re: question about Custom Tag performance

It's easy to overuse things like message keys. 

With a Model 2 approach, it can be just as easy to look up the messages
"server-side" and then deliver them to the page all wrapped up in a
JavaBean. 

The ResourceBundles are not strongly tied to JSP tags, just something
that tags can use too. 

Personally, I consider resolving i18n part of the business layer. The
text of the localized message is going to be the same regardless of what
presentation system you are using. The presentation layer has to markup
the text, but the text itself is not presentation logic. i18n tags are
handy for quick-and-easy jobs, but returning localized messages on a
larger scale is a job better suited to an Action and a JavaBean than a
tag. Then, you could reuse the same logic when printing a text report as
a PDF, for example. 

A whole 'nother approach is to use the i18n capabilities of Tiles. Here
you can have one layout Tile and different interior Tiles for each
supported locale. This is a great way to go when embedding the localized
text into a markup page is not a problem. Since the interior Tiles
contain a minimum of markup (most of the chrome is in the layout tile),
it wouldn't be hard to get translators to work with the tiles, or markup
them up afterwards. Of course, this is not such a reusable solution as
something based on using localized JavaBeans to transport the text, but
it is straight-forward.

-- Ted Husted, Husted dot Com, Fairport NY US
-- Developing Java Web Applications with Struts
-- Tel: +1 585 737-3463
-- Web: http://husted.com/about/services


> Ted,
> 
> I read the book you wrote, JSP site design, and I do have a quick
> question for you: How does the jsp custom tag affect the performance of
> the web application?
> 
> I am using JRun 3.1 and I use custom tag for i18n. Therefore, there are
> many tags like <lib:message key="key"/> on a jsp. The problem is the
> handler objects are not pooled by the server runner, so a new instance
> is created for each key. It is a performance disaster!!!
> 
> I think it has to happend to Struts too. Do you have any idea on this?
> 
> I will greatly appreciate your pointers.
> 
> Jack

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>