Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Caching JSP/JSF page fragments - best practice?

J J Wright
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm trying to ascertain what's the best approach when designing JSP/JSF pages containing cacheable fragments. I've looked at WebSphere DynaCache, OSCache, and JBossCache for hints but the information is conflicting in some ways. One of the tips I keep seeing regarding J2EE applications is "design to the spec, not the application server". This is all well and good but caching dynamic content isn't part of the J2EE spec!

So my question is basically this. Do you create all cacheable and non cacheable fragments as autonomous JSP pages that can be uniquely identified by their URL and request parameters (as DynaCache requires), or do you rely on the fact you're caching solution / application server provides a tag lib that enables you to carve up individual pages?

I can see the benefits of having autonomous JSP pages (as described in Composite View pattern), but is there a danger this can become an anti-pattern when taken to extremes? Also, if you don't know what your target app server is when you're architecting a solution how do you decide?

Any thoughts would be greatly appreciated.

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic