Hello
Struts Folks --
I'm (very new to Struts2 but am) working on integrating Struts2 as an MVC foundation for a web app that, at the moment, just provides a set of custom taglibs and a data object layer for a team of content creators and page designers, using Hibernate-by-way-of-Spring-IOC.
The goal is to build in a templating aspect to the app, where requests to the actions, after business logic, result in template-driven output (either through Velocity or FreeMarker), or a
JSP error page. In selecting Struts2, I'd thought that it'd be possible to provide support for both along with JSP, based on the selection of result types I can choose from
(freemarker, velocity, default JSP, et cetera).
Using the Struts2 Starter archetype in
Maven, I know I can start with this...
web.xml
...and substitute
org.apache.struts2.sitemesh.FreeMarkerPageFilter or
org.apache.struts2.sitemesh.VelocityPageFilter for
PageFilter. But I'm not clear on how I should layer in the filters for all three, if the action's conditions could result in a different template being driven, like this:
struts.xml
Trying to direct to the native VelocityResult with PageFilter turned on results in ClassNotFound exceptions for Velocity's Context object; switching to VelocityPageFilter but directing to a default JSP result returns exceptions complaining about missing FreeMarker dependencies.
In searching JavaRanch and the web at large, I've found examples showing me that I
can use Velocity or FM or JSP for view output, but nothing saying that I can (or can't, for that matter) provide support for all three, switching between results when I need to. Have I stumbled upon an implied, but not explicit, limitation of Struts2, or am I missing something painfully obvious?
Peter DiCrescenzo
peter.dicrescenzo@gartner.com