org.ibisph.mvc.view
Class ErrorJSP

java.lang.Object
  extended by org.ibisph.mvc.view.ErrorJSP
All Implemented Interfaces:
org.springframework.web.servlet.View

public class ErrorJSP
extends java.lang.Object
implements org.springframework.web.servlet.View

Simple JSP view used to display error messages and exceptions.

Author:
Garth Braithwaite, STG

Constructor Summary
ErrorJSP()
           
ErrorJSP(java.lang.String jspName)
          Constructor which sets the JSP name property.
 
Method Summary
 boolean getAddContextPathPrefix()
           
 java.lang.String getContentType()
          Spring View required method.
 void render(java.util.Map modelMap, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Spring framework MVC View Render method for JSP error view request.
 void setAddContextPathPrefix(boolean addContextPathPrefix)
          Controls if the jsp filename should include the application context path as a prefix to the jsp path and filename property.
 void setJSP(java.lang.String jspPathAndFilename)
          Sets error JSP path (or partial path) and filename.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ErrorJSP

public ErrorJSP()

ErrorJSP

public ErrorJSP(java.lang.String jspName)
Constructor which sets the JSP name property.

Method Detail

getContentType

public java.lang.String getContentType()
Spring View required method.

Specified by:
getContentType in interface org.springframework.web.servlet.View
Returns:
"text/html".

setJSP

public void setJSP(java.lang.String jspPathAndFilename)
Sets error JSP path (or partial path) and filename.

Parameters:
jspPathAndFilename - Filename and full/partial path of the error jsp to be used.

setAddContextPathPrefix

public void setAddContextPathPrefix(boolean addContextPathPrefix)
Controls if the jsp filename should include the application context path as a prefix to the jsp path and filename property.

Parameters:
addContextPathPrefix - true tells the view to add the application context path as a prefix to the jspPathAndFilename property to determine the complete JSP path and filename. If set to false the jspPathAndFilename property is considered complete and used as specified.

getAddContextPathPrefix

public boolean getAddContextPathPrefix()

render

public void render(java.util.Map modelMap,
                   javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
Spring framework MVC View Render method for JSP error view request. The view code simply gets the model map keys and values, which contain the error messages, and puts these into the session as attributes. If the addContextPathPrefix property is set to true , then the application context path is added as a prefix to the jspPathAndFilename, otherwise the filename and path are used as is. The user's request is then redirected to the error JSP. The error JSP then pulls the session attributes error messages to be displayed to the user.

Specified by:
render in interface org.springframework.web.servlet.View
Parameters:
modelMap - Spring framework MVC model map which contains the error messages and any exceptions.
request - HTTP request used to set the session attribute and to get the application context path.
response - HTTP response passed from Spring MVC framework used to send an HTTP redirect to the error JSP.