public class MiscTemplate extends Template
If "remove" is specified, then the source variables are removed. If
All the conversion options provided by <stringop> are also available.
Example:
<mapnames src=query.pref_* dst="pref_${1}" namepace=${SessionID}.pref>Will take the query parameters from the current form that refer to user preferences, and save them in a preferences namespace associated with the current session.
When "type=hex", then "start" is taken to be a hex value (or 0 if start is not a valid hex value).
When "type=alpha", the "start" must contain only a-z, and the result is the alpabetic result, in radix 26.
Modifier and Type | Class and Description |
---|---|
static class |
MiscTemplate.GlobProperties
Special version of a properties that uses the sub expresions
of the supplied glob pattern and name to define the keys 1-9.
|
Constructor and Description |
---|
MiscTemplate() |
Modifier and Type | Method and Description |
---|---|
static int |
fromAlpha(java.lang.String s)
Convert an alpha-only string to an integer.
|
boolean |
init(RewriteContext hr)
Called before this template processes any tags.
|
void |
tag_append(RewriteContext hr)
Append a value to a property, with an optional delimeter.
|
void |
tag_eval(RewriteContext hr)
Evaluate the contents of a variable as a template, as if
it was "inline" here.
|
void |
tag_expr(RewriteContext hr)
Set a variable to the result of an arithmetic expression
<expr [name=nnn] value="expr" [format="..." ] [namespace="..."]>
sets name to "NaN" if the expression was invalid.
|
void |
tag_increment(RewriteContext hr)
Increment the value of a variable.
|
void |
tag_inline(RewriteContext hr)
Set a variable to all the markup 'till the /inline tag.
|
void |
tag_mapnames(RewriteContext hr)
Map a set of properties from one namespace to another,
and (optionally) change their names and values.
|
void |
tag_pop(RewriteContext hr)
Treat a variable as a stack, and pop a value from it.
|
void |
tag_push(RewriteContext hr)
Treat a variable as a stack, and push a value onto it.
|
void |
tag_random(RewriteContext hr) |
void |
tag_sequence(RewriteContext hr)
Generate a (mostly) numeric sequence.
|
void |
tag_stringlength(RewriteContext hr)
Compute string length from "value" , return in "name"
|
void |
tag_stringop(RewriteContext hr)
String manipulation functions.
|
static java.lang.String |
toAlpha(int i) |
public void tag_append(RewriteContext hr)
public void tag_increment(RewriteContext hr)
public void tag_sequence(RewriteContext hr)
public void tag_expr(RewriteContext hr)
If "name" is omitted, the result is placed in the document. If "format" is used, it is java.text.DecimalFormat format specifier. Briefly:
format="$#,##0.00"
would be typical for
expressing monetary values.public void tag_eval(RewriteContext hr)
public boolean init(RewriteContext hr)
Template
init
in interface TemplateInterface
init
in class Template
public void tag_push(RewriteContext hr)
The result is placed in the local namespace, unless the "namespace" is used to override it. Use namespace=${SessionID} to put the result into the current session.
public void tag_pop(RewriteContext hr)
public void tag_inline(RewriteContext hr)
If "eval" is true, then ${..} substitutions are performed before assigning the markup the the named variable. If "esc" is also true, the \X sequences will be replaced as well. If "append" is true and "name" is specified, then the markup is appended to the current contents of "name". If no "name" is specified, the markup is output as-is, after ${..} substitutions (e.g. eval=true is implied).
public void tag_stringop(RewriteContext hr)
The "namespace" attribute can be used to alter the namespace to put the result into, in which case the "sessionTable" configuration parameter can be used to alter the namespace class, which defaults to the template handler's (or filter's) prefix.
public void tag_stringlength(RewriteContext hr)
public void tag_mapnames(RewriteContext hr)
public void tag_random(RewriteContext hr)
public static java.lang.String toAlpha(int i)
public static int fromAlpha(java.lang.String s)