Announcement Announcement Module
No announcement yet.
AbstractXsltView Usage and Memory problems Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • AbstractXsltView Usage and Memory problems

    I have a memory problem, which may be related to the way I am using the AbstractXsltView.

    My application uses Xslt to render all views, so I have a number of view classes which inherit from AbstractXsltView which create the xml to render from the model. All of these views use the same xslt stylesheet.

    It seems that the AbstractXsltView creates a copy of this template for each instance of view which is created. My application has around a thousand views, thus I have a thousand copies of the same template in memory.

    Is there a way in which I can avoid this using the framework?

    The way I have got around this by creating my own version of AbstractXslView which allows me to set a "XslTemplate" as a bean property. "XslTemplate" is my own class which handles the loading and caching of the xsl template. This allows me to share the Templates object between my views, so that I only have one in memory.