Hi,
I´m successfully using custom jsp tags within
iWS4.1.
Usually, I try write code that performs
well. So, object caching is a normal procedure. Therefore, I was a
little bit surprised when I saw the profiler showing that the introduction of
the custom jsp tags increased the memory footprint by far. The key is that each
use of a custom tag leads to a new TagHandler instance.
The spec already states that a custom tag developer
should implement the release() method. I do this, therefore all TagHandlers are
stateless, using a cache would not be a problem.
Is there a way to say to the iWS JSP engine that it
should cache tags?
Or do I really have to do this inside of the
TagHandler implementation (e.g. by applying the singleton pattern, or by pasting
the caching code inside of the constructor)??
Here's an excerpt of the generated Java
code:
/* ---- fredotags:searchConditionCombo ---- */
com.tao.fredo.jsp.tags.SearchConditionComboTag
_jspx_th_fredotags_searchConditionCombo_11 = new
com.tao.fredo.jsp.tags.SearchConditionComboTag();
_jspx_th_fredotags_searchConditionCombo_11.setPageContext(pageContext);
_jspx_th_fredotags_searchConditionCombo_11.setParent(null);
_jspx_th_fredotags_searchConditionCombo_11.setPropertyID( 0);
try {
..
} finally {
_jspx_th_fredotags_searchConditionCombo_11.release();
}
..
/* ---- fredotags:searchConditionCombo ---- */
com.tao.fredo.jsp.tags.SearchConditionComboTag
_jspx_th_fredotags_searchConditionCombo_11 = new
com.tao.fredo.jsp.tags.SearchConditionComboTag();
_jspx_th_fredotags_searchConditionCombo_11.setPageContext(pageContext);
_jspx_th_fredotags_searchConditionCombo_11.setParent(null);
_jspx_th_fredotags_searchConditionCombo_11.setPropertyID( 1);
try {
..
} finally {
_jspx_th_fredotags_searchConditionCombo_11.release();
}