Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Won't Fix
-
None
-
None
-
None
-
Important
Description
struts2 supports sitemesh2.4 now, WW-3291
I'd like to extends the default OldDecorator2NewStrutsFreemarkerDecorator to do something fantastic,like compress page,render html fragment for AJAX request
I with struts provide a @Inject way.
here is sample code
public class MyOldDecorator2NewStrutsFreemarkerDecorator extends OldDecorator2NewStrutsFreemarkerDecorator {
public static final String X_FRAGMENT = "X-FRAGMENT";
public MyOldDecorator2NewStrutsFreemarkerDecorator(Decorator oldDecorator)
{ super(oldDecorator); } protected void render(Content content, HttpServletRequest request,
HttpServletResponse response, ServletContext servletContext,
ActionContext ctx) throws ServletException, IOException {
String replacement = request.getHeader(X_FRAGMENT);
if (replacement != null)
else
{ super.render(content, request, response, servletContext, ctx); }}
}