public class IncludePage extends java.lang.Object implements TemplateDirectiveModel
|Constructor and Description|
|Modifier and Type||Method and Description|
Executes this user-defined directive; called by FreeMarker when the user-defined directive is called in the template.
public IncludePage(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
public void execute(Environment env, java.util.Map params, TemplateModel loopVars, TemplateDirectiveBody body) throws TemplateException, java.io.IOException
This method should not throw
IOException that wasn't caused by writing
to the output. Such exceptions should be catched inside the method and wrapped inside a
TemplateException. (Note that setting
true can mitigate the negative effects of implementations that throw
env- the current processing environment. Note that you can access the output
params- the parameters (if any) passed to the directive as a map of key/value pairs where the keys are
String-s and the values are
TemplateModelinstances. This is never
null. If you need to convert the template models to POJOs, you can use the utility methods in the
loopVars- an array that corresponds to the "loop variables", in the order as they appear in the directive call. ("Loop variables" are out-parameters that are available to the nested body of the directive; see in the Manual.) You set the loop variables by writing this array. The length of the array gives the number of loop-variables that the caller has specified. Never
null, but can be a zero-length array.
body- an object that can be used to render the nested content (body) of the directive call. If the directive call has no nested content (i.e., it's like <@myDirective /> or <@myDirective></@myDirective>), then this will be
TemplateException- If any problem occurs that's not an
IOExceptionduring writing the template output.
java.io.IOException- When writing the template output fails. Other
IOException-s should be catched in this method and wrapped into