Interface TemplateService
-
- All Known Implementing Classes:
VelocityTemplateService
public interface TemplateServiceProvides a templating service interface.Configuration
The default TemplateService isVelocityTemplateService. However you can instruct Click to use a different implementation by adding the following element to your click.xml configuration file.<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <click-app charset="UTF-8"> <pages package="org.apache.click.examples.page"/> <template-service classname="org.apache.click.extras.service.FreemarkerTemplateService"> </click-app>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidonDestroy()Destroy the TemplateService.voidonInit(jakarta.servlet.ServletContext servletContext)Initialize the TemplateService with the given application configuration service instance.voidrenderTemplate(String templatePath, Map<String,?> model, Writer writer)Render the given template and model to the writer.voidrenderTemplate(org.openidentityplatform.openam.click.Page page, Map<String,?> model, Writer writer)Render the given page to the writer.
-
-
-
Method Detail
-
onInit
void onInit(jakarta.servlet.ServletContext servletContext) throws ExceptionInitialize the TemplateService with the given application configuration service instance. This method is invoked after the TemplateService has been constructed. Note you can accessConfigServiceby invokingClickUtils.getConfigService(jakarta.servlet.ServletContext)- Parameters:
servletContext- the application servlet context- Throws:
Exception- if an error occurs initializing the Template Service
-
onDestroy
void onDestroy()
Destroy the TemplateService.
-
renderTemplate
void renderTemplate(org.openidentityplatform.openam.click.Page page, Map<String,?> model, Writer writer) throws IOException, org.apache.click.service.TemplateExceptionRender the given page to the writer.- Parameters:
page- the page template to rendermodel- the model to merge with the template and renderwriter- the writer to send the merged template and model data to- Throws:
IOException- if an IO error occursorg.apache.click.service.TemplateException- if template error occurs
-
renderTemplate
void renderTemplate(String templatePath, Map<String,?> model, Writer writer) throws IOException, org.apache.click.service.TemplateException
Render the given template and model to the writer.- Parameters:
templatePath- the path of the template to rendermodel- the model to merge with the template and renderwriter- the writer to send the merged template and model data to- Throws:
IOException- if an IO error occursorg.apache.click.service.TemplateException- if template error occurs
-
-