It is my sincere hope that our talk of math doesn't give you goose bumps, dispelling such fears this early is necessary for some to be able to complete this recipe especially since we are not attempting such things as used in RSA cryptography.
We basically want to be able to count stuff and do simple arithmetic operations which in my humble opinion is quite safe.
Make an XTemplate
object with the HTML format string which should contain property names from the intended data wrapped in curly brackets. Arithmetic operations can be done on a property value by applying an arithmetic operator to the property and a numeric literal.
Counting items in a list or showing the ordinal value of an item within a list being processed within a <tpl for="...">
block is done with the use of a special {#}
expression.
private String getTemplate(){ StringBuilder sb = new StringBuilder(); sb.append("<p>Name: {name}</p>"); sb.append("<p>Email: {email...