我正在尝试调用#{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" ...
答案 0 :(得分:0)
在表达式语言(简称EL)中,一个不调用方法,一个解析属性。想象一下,你在范围内有一个名为shop
的变量,在Java中你会写
shop.getName()
而在EL中你会写
#{shop.name}
EL解析器会为您调用getName()
。
答案 1 :(得分:0)
如果您的EL有参数,则必须直接调用方法名称。
埃尔
#{MyBean.getName('Hello')}
#{MyBean.process(obj)}
豆
public String getName(String value) {
return value + " World!";
}
public void process(Object object) {
//here your process
}