| org.springframework.web.context.support.WebApplicationObjectSupport org.springframework.web.servlet.view.AbstractView
All known Subclasses: org.springframework.web.servlet.view.document.AbstractJExcelView, org.springframework.web.servlet.view.AbstractUrlBasedView, org.springframework.web.servlet.view.document.AbstractPdfView, org.springframework.web.servlet.view.xslt.AbstractXsltView, org.springframework.web.servlet.view.document.AbstractExcelView,
Method Summary | |
public void | addStaticAttribute(String name, Object value) Add static data to this view, exposed in each view. | protected RequestContext | createRequestContext(HttpServletRequest request, Map model) Create a RequestContext to expose under the specified attribute name.
Default implementation creates a standard RequestContext instance for the
given request and model. | protected void | exposeModelAsRequestAttributes(Map model, HttpServletRequest request) Expose the model objects in the given map as request attributes. | public Map | getAttributesMap() Allow Map access to the static attributes of this view,
with the option to add or override specific entries.
Useful for specifying entries directly, for example via
"attributesMap[myKey]". | public String | getBeanName() Return the view's name. | public String | getContentType() Return the content type for this view. | public String | getRequestContextAttribute() Return the name of the RequestContext attribute, if any. | public Map | getStaticAttributes() Return the static attributes for this view. | public void | render(Map model, HttpServletRequest request, HttpServletResponse response) Prepares the view given the specified model, merging it with static
attributes and a RequestContext attribute, if necessary. | abstract protected void | renderMergedOutputModel(Map model, HttpServletRequest request, HttpServletResponse response) Subclasses must implement this method to actually render the view. | public void | setAttributes(Properties attributes) Set static attributes for this view from a
java.util.Properties object.
This is the most convenient way to set static attributes. | public void | setAttributesCSV(String propString) Set static attributes as a CSV string. | public void | setAttributesMap(Map attributes) Set static attributes for this view from a Map. | public void | setBeanName(String beanName) Set the view's name. | public void | setContentType(String contentType) Set the content type for this view.
Default is "text/html;charset=ISO-8859-1".
May be ignored by subclasses if the view itself is assumed
to set the content type, e.g. | public void | setRequestContextAttribute(String requestContextAttribute) Set the name of the RequestContext attribute for this view. | public String | toString() |
DEFAULT_CONTENT_TYPE | final public static String DEFAULT_CONTENT_TYPE(Code) | | Default content type. Overridable as bean property.
|
addStaticAttribute | public void addStaticAttribute(String name, Object value)(Code) | | Add static data to this view, exposed in each view.
Must be invoked before any calls to render .
Parameters: name - the name of the attribute to expose Parameters: value - the attribute value to expose See Also: AbstractView.render |
exposeModelAsRequestAttributes | protected void exposeModelAsRequestAttributes(Map model, HttpServletRequest request) throws Exception(Code) | | Expose the model objects in the given map as request attributes.
Names will be taken from the model Map.
This method is suitable for all resources reachable by
javax.servlet.RequestDispatcher .
Parameters: model - Map of model objects to expose Parameters: request - current HTTP request |
getAttributesMap | public Map getAttributesMap()(Code) | | Allow Map access to the static attributes of this view,
with the option to add or override specific entries.
Useful for specifying entries directly, for example via
"attributesMap[myKey]". This is particularly useful for
adding or overriding entries in child view definitions.
|
getBeanName | public String getBeanName()(Code) | | Return the view's name. Should never be null ,
if the view was correctly configured.
|
getContentType | public String getContentType()(Code) | | Return the content type for this view.
|
getRequestContextAttribute | public String getRequestContextAttribute()(Code) | | Return the name of the RequestContext attribute, if any.
|
getStaticAttributes | public Map getStaticAttributes()(Code) | | Return the static attributes for this view. Handy for testing.
Returns an unmodifiable Map, as this is not intended for
manipulating the Map but rather just for checking the contents.
the static attributes in this view |
renderMergedOutputModel | abstract protected void renderMergedOutputModel(Map model, HttpServletRequest request, HttpServletResponse response) throws Exception(Code) | | 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.
Parameters: model - combined output Map (never null ),with dynamic values taking precedence over static attributes Parameters: request - current HTTP request Parameters: response - current HTTP response throws: Exception - if rendering failed |
setAttributes | public void setAttributes(Properties attributes)(Code) | | Set static attributes for this view from a
java.util.Properties object.
This is the most convenient way to set static attributes. Note that
static attributes can be overridden by dynamic attributes, if a value
with the same name is included in the model.
Can be populated with a String "value" (parsed via PropertiesEditor)
or a "props" element in XML bean definitions.
See Also: org.springframework.beans.propertyeditors.PropertiesEditor |
setAttributesCSV | public void setAttributesCSV(String propString) throws IllegalArgumentException(Code) | | Set static attributes as a CSV string.
Format is: attname0={value1},attname1={value1}
|
setAttributesMap | public void setAttributesMap(Map attributes)(Code) | | Set static attributes for this view from a Map. This allows to set
any kind of attribute values, for example bean references.
Can be populated with a "map" or "props" element in XML bean definitions.
Parameters: attributes - Map with name Strings as keys and attribute objects as values |
setBeanName | public void setBeanName(String beanName)(Code) | | Set the view's name. Helpful for traceability.
Framework code must call this when constructing views.
|
setContentType | public void setContentType(String contentType)(Code) | | Set the content type for this view.
Default is "text/html;charset=ISO-8859-1".
May be ignored by subclasses if the view itself is assumed
to set the content type, e.g. in case of JSPs.
|
setRequestContextAttribute | public void setRequestContextAttribute(String requestContextAttribute)(Code) | | Set the name of the RequestContext attribute for this view.
Default is none.
|
|
|