org.melati.template.velocity
Class VelocityServletTemplateContext

Package class diagram package VelocityServletTemplateContext
java.lang.Object
  extended by org.melati.template.velocity.VelocityTemplateContext
      extended by org.melati.template.velocity.VelocityServletTemplateContext
All Implemented Interfaces:
ServletTemplateContext, TemplateContext

public class VelocityServletTemplateContext
extends VelocityTemplateContext
implements ServletTemplateContext

Implements a template context for Melati with Velocity. The Request and Response are placed in the context so that they can be accessed by the Form object.

Author:
Tim Joyce

Field Summary
static String FORM
          Mimicking the $Form behaviour of Webmacro.
static String REQUEST
          The HTTP request object context key.
static String RESPONSE
          The HTTP response object context key.
 
Fields inherited from class org.melati.template.velocity.VelocityTemplateContext
velContext
 
Constructor Summary
VelocityServletTemplateContext(org.apache.velocity.VelocityContext vc)
          Constructor.
 
Method Summary
 String getFormField(String s)
          Get a field from an HTML Form.
 MultipartFormField getMultipartFormField(String s)
          Returns null as this is not a multi part form.
 javax.servlet.http.HttpSession getSession()
          Get the HttpSession .
 
Methods inherited from class org.melati.template.velocity.VelocityTemplateContext
get, getContext, put, setPassbackExceptionHandling, setPropagateExceptionHandling
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.melati.template.TemplateContext
get, getContext, put, setPassbackExceptionHandling, setPropagateExceptionHandling
 

Field Detail

REQUEST

public static final String REQUEST
The HTTP request object context key.

See Also:
Constant Field Values

RESPONSE

public static final String RESPONSE
The HTTP response object context key.

See Also:
Constant Field Values

FORM

public static final String FORM
Mimicking the $Form behaviour of Webmacro.

See Also:
Constant Field Values
Constructor Detail

VelocityServletTemplateContext

public VelocityServletTemplateContext(org.apache.velocity.VelocityContext vc)
Constructor.

Parameters:
vc - context containing RESPONSE and REQUEST
Method Detail

getFormField

public String getFormField(String s)
Get a field from an HTML Form.

Specified by:
getFormField in interface ServletTemplateContext
Parameters:
s - the field's name
Returns:
the field value, null if not set
See Also:
ServletTemplateContext.getFormField(java.lang.String)

getMultipartFormField

public MultipartFormField getMultipartFormField(String s)
Returns null as this is not a multi part form. Should perhaps throw an exception.

Specified by:
getMultipartFormField in interface ServletTemplateContext
Parameters:
s - the field's name
Returns:
the field's value
See Also:
ServletTemplateContext.getMultipartFormField(java.lang.String)

getSession

public javax.servlet.http.HttpSession getSession()
Get the HttpSession .

Specified by:
getSession in interface ServletTemplateContext
Returns:
the current HttpSession
See Also:
ServletTemplateContext.getSession()


Copyright © 2000-2010 PanEris. All Rights Reserved.