-
Notifications
You must be signed in to change notification settings - Fork 0
Nested Templates
tporcham edited this page Jan 30, 2019
·
1 revision
Using the Template Registry you can nest templates inside each other and call them like methods. To call a template inside another template use the 'includeByRef' tag. You must pass any variables used by the nested template via key/value parameters, as shown by the user template parameter in the following example. The following example parses a template which does nothing other than include another template. Recursion is allowed.
TemplateRegistry registry = new MVELTemplateRegistry();
registry.registerTemplate("welcomeUser", "Hellow @{user}");
TemplateInterpreter.parse("@includeByRef{helloUser(user = \"bob\")}", base, map, registry);
This is the documentation for MVEL 1.2.x and 1.3.x. If you are using MVEL 2.*, please proceed to the documentation for MVEL 2.*