Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Groovy templates is a templating engine for JavaScript. It lets you insert dynamic content in any text through the use of templates. A template contains variables and/or expressions, which get replaced with values when a template is rendered. This is very similar to JSP markup. 

On this page:


Groovy templates in JMWE are used in

...

To output the result of a simple Groovy code:

...

, write your Groovy code as <%=

...

some

...

Groovy

...

code

...

%>. For example, <%= 

To simply execute a simple Groovy code :

...

and not output the result, write your Groovy code as <% some Groovy code %>

You could also use $Groovy code, but only for a variable and not when a method is called on a variable. For example:

$currentUser() returns an ApplicationUser

$currentUser.name returns the name of the ApplicationUser

$currentUser.getName() returns an error

Groovy template examples:

Write the issue key as a comment to the issue:

...