org.springframework.web.servlet.view
Class AbstractTemplateView
java.lang.Object
org.springframework.context.support.ApplicationObjectSupport
org.springframework.web.context.support.WebApplicationObjectSupport
org.springframework.web.servlet.view.AbstractView
org.springframework.web.servlet.view.AbstractUrlBasedView
org.springframework.web.servlet.view.AbstractTemplateView
- All Implemented Interfaces:
- ApplicationContextAware, BeanNameAware, View
- Direct Known Subclasses:
- FreeMarkerView, VelocityView
- public abstract class AbstractTemplateView
- extends AbstractUrlBasedView
AbstractTemplateView provides template based view technologies such as
Velocity and FreeMarker with the ability to use request and session
attributes in their model.
JSP/JSTL and other view technologies automatically have access to the
HttpServletRequest object and thereby the request/session attributes
for the current user.
- Since:
- May 17, 2004
- Version:
- $Id: AbstractTemplateView.java,v 1.2 2004/05/21 19:33:38 jhoeller Exp $
- Author:
- Darren Davison, Juergen Hoeller
Method Summary |
protected void |
renderMergedOutputModel(java.util.Map model,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Subclasses must implement this method to actually render the view.
|
protected abstract void |
renderMergedTemplateModel(java.util.Map model,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Subclasses must implement this method to actually render the view. |
void |
setExposeRequestAttributes(boolean exposeRequestAttributes)
Set whether all request attributes should be added to the
model prior to merging with the template. |
void |
setExposeSessionAttributes(boolean exposeSessionAttributes)
Set whether all HttpSession attributes should be added to the
model prior to merging with the template. |
Methods inherited from class org.springframework.web.servlet.view.AbstractView |
addStaticAttribute, getBeanName, getContentType, getStaticAttributes, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setRequestContextAttribute |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractTemplateView
public AbstractTemplateView()
setExposeRequestAttributes
public void setExposeRequestAttributes(boolean exposeRequestAttributes)
- Set whether all request attributes should be added to the
model prior to merging with the template.
setExposeSessionAttributes
public void setExposeSessionAttributes(boolean exposeSessionAttributes)
- Set whether all HttpSession attributes should be added to the
model prior to merging with the template.
renderMergedOutputModel
protected final void renderMergedOutputModel(java.util.Map model,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws java.lang.Exception
- Description copied from class:
AbstractView
- Subclasses must implement this method to actually render the view.
The first step will be preparing the request: In the JSP case,
this would mean setting model objects as request attributes.
The second step will be the actual rendering of the view,
for example including the JSP via a RequestDispatcher.
- Specified by:
renderMergedOutputModel
in class AbstractView
- Parameters:
model
- combined output Map, with dynamic values taking
precedence over static attributesrequest
- current HTTP requestresponse
- current HTTP response
- Throws:
java.lang.Exception
- if rendering failed
renderMergedTemplateModel
protected abstract void renderMergedTemplateModel(java.util.Map model,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws java.lang.Exception
- Subclasses must implement this method to actually render the view.
- Parameters:
model
- combined output Map, with request attributes and
session attributes merged into it if requiredrequest
- current HTTP requestresponse
- current HTTP response
- Throws:
java.lang.Exception
- if rendering failed
Copyright (C) 2003-2004 The Spring Framework Project.