radioAe6rt

Caching Struts Tiles

leave a comment »

This is not an easy nut to crack, but if you want to cache Struts Tiles, you can clone the Tiles JSP InsertTag to suit the need. Around where doInclude(page) appears, render the referenced JSP page using an HTTPResponseWrapper, and ehcache the result before writing it to the tag pageContext writer. You might also consider augmenting the tile controller with a getCacheKey() method that returns a rich cache key in the form of a java.lang.Object with judiciously implemented overrides of equals() and hashcode(). Then, in the tag code, you can get a reference to the controller and therefore to getCacheKey() and cache the rendered-in-place content.

Advertisement

Written by radioae6rt

July 30, 2011 at 12:43 pm

Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.