我已经使用Expression Language (EL)myUnmanagedBean.fn()
来计算来自 Java 类的链接标签的文本。其中 myUnmanagedBean 是 bean 的名称。
功能是,
private static String s="vijay";
static String fn()
{
return s;
}
我已经向 xpage 添加了一个数据上下文,相应的代码是:
<xp:this.dataContexts>
<xp:dataContext var="myUnmanagedBean"
value="${javascript:new com.kkmsoft.vijay.Invoke1()}">
</xp:dataContext>
</xp:this.dataContexts>
错误页面显示:
Exception:
myUnmanagedBean.fn()
Encountered "(", expected one of ["}", ".", ">", "gt", "<", "lt", "==", "eq", "<=", "le", ">=", "ge", "!=", "ne", "[", "+", "-", "*", "/", "div", "%", "mod", "and", "&&", "or", "||", "?"]
Encountered "(" at line 1, column 21. Was expecting one of: "}" ... "." ... ">" ... "gt" ... "<" ... "lt" ... "==" ... "eq" ... "<=" ... "le" ... ">=" ... "ge" ... "!=" ... "ne" ... "[" ... "+" ... "-" ... "*" ... "/" ... "div" ... "%" ... "mod" ... "and" ... "&&" ... "or" ... "||" ... "?" ...
在堆栈跟踪中,
javax.faces.el.ReferenceSyntaxException: myUnmanagedBean.fn()
com.sun.faces.application.ApplicationImpl.checkSyntax(Unknown Source)
该数据上下文仅用于测试目的;我知道这不是一个理想的方法。问题是什么?