0

我正在尝试调用#{expressions.getClass()},但是我收到了异常。从例外情况来看,似乎不允许使用 ( ) 之类的字符。请参阅以下异常详细信息:

    javax.faces.el.ReferenceSyntaxException: javax.el.ELException: Error Parsing: #{
    org.jboss.seam.core.expressions.getClass()}
    at com.sun.faces.application.ApplicationImpl.createValueBinding(Applicat
ionImpl.java:488)
    at org.jboss.seam.jsf.SeamApplication11.createValueBinding(SeamApplicati
on11.java:143)
    at org.jboss.seam.jsf.SeamApplication11.createValueBinding(SeamApplicati
on11.java:143)
    at com.successfactors.jsfcore.ui.config.SFApplication.createValueBinding
(SFApplication.java:355)
    at org.jboss.seam.core.Expressions$1.getFacesValueBinding(Expressions.ja
va:119)
    at org.jboss.seam.core.Expressions$1.getValue(Expressions.java:69)
    at org.jboss.seam.core.Interpolator.interpolateExpressions(Interpolator.
java:88)
    at org.jboss.seam.core.Interpolator.interpolate(Interpolator.java:67)
    ...
    ...
    at java.lang.Thread.run(Thread.java:662)
    Caused by: javax.el.ELException: Error Parsing: #{org.jboss.seam.core.expressions.getClass()}
    at org.apache.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:125)
    at org.apache.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:150)
    at org.apache.el.lang.ExpressionBuilder.createValueExpression(ExpressionBuilder.java:194)
    at    org.apache.el.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:68)
    at com.sun.faces.application.ApplicationImpl.createValueBinding(ApplicationImpl.java:484)
    ... 87 more
    Caused by: org.apache.el.parser.ParseException: Encountered " "(" "( "" at line 1, column 43.
    Was expecting one of:
    "}" ...
    "." ...
    "[" ...
    ">" ...
    "gt" ...
    "<" ...
    "lt" ...
    ">=" ...
    "ge" ...
    "<=" ...
    "le" ...
    "==" ...
    "eq" ...
    "!=" ...
    "ne" ...
    "&&" ...
    "and" ...
    "||" ...
    "or" ...
    "*" ...
    "+" ...
    "-" ...
    "/" ...
    "div" ...
    "%" ...
    "mod" ...
4

2 回答 2

0

如果你的 EL 有参数,你必须直接调用方法名。

埃尔

#{MyBean.getName('Hello')}
#{MyBean.process(obj)}

public String getName(String value) {
    return value + " World!";
}

public void process(Object object) {
    //here your process
}
于 2013-07-31T09:17:04.217 回答
0

在表达式语言(或简称 EL)中,一个不调用方法,一个解析属性。想象一下,你有一个shop在范围内调用的变量,在 Java 中你会写

shop.getName()

而在 EL 你会写

#{shop.name}

EL 解析器将为getName()您调用。

于 2013-07-31T08:42:09.477 回答