Methods Summary |
---|
protected boolean | altSyntax()
return ContextUtil.isUseAltSyntax(getStack().getContext());
|
protected java.lang.String | findString(java.lang.String expr)
return (String) findValue(expr, String.class);
|
protected java.lang.Object | findValue(java.lang.String expr)
if (altSyntax()) {
// does the expression start with %{ and end with }? if so, just cut it off!
if (expr.startsWith("%{") && expr.endsWith("}")) {
expr = expr.substring(2, expr.length() - 1);
}
}
return getStack().findValue(expr);
|
protected java.lang.Object | findValue(java.lang.String expr, java.lang.Class toType)
if (altSyntax() && toType == String.class) {
return translateVariables(expr, getStack());
} else {
if (altSyntax()) {
// does the expression start with %{ and end with }? if so, just cut it off!
if (expr.startsWith("%{") && expr.endsWith("}")) {
expr = expr.substring(2, expr.length() - 1);
}
}
return getStack().findValue(expr, toType);
}
|
protected java.lang.String | getBody()
if (bodyContent == null) {
return "";
} else {
return bodyContent.getString().trim();
}
|
protected com.opensymphony.xwork2.util.ValueStack | getStack()
return TagUtils.getStack(pageContext);
|
public void | setId(java.lang.String string)
super.setId(string);
|
protected java.lang.String | toString(java.lang.Throwable t)
FastByteArrayOutputStream bout = new FastByteArrayOutputStream();
PrintWriter wrt = new PrintWriter(bout);
t.printStackTrace(wrt);
wrt.close();
return bout.toString();
|
public static java.lang.String | translateVariables(java.lang.String expression, com.opensymphony.xwork2.util.ValueStack stack)
while (true) {
int x = expression.indexOf("%{");
int y = expression.indexOf("}", x);
if ((x != -1) && (y != -1)) {
String var = expression.substring(x + 2, y);
Object o = stack.findValue(var, String.class);
if (o != null) {
expression = expression.substring(0, x) + o + expression.substring(y + 1);
} else {
// the variable doesn't exist, so don't display anything
expression = expression.substring(0, x) + expression.substring(y + 1);
}
} else {
break;
}
}
return expression;
|