프로그래밍 방식으로 내 백업 빈 중 하나에서 메서드를 호출하거나 호출해야합니다. 몇 가지 예를 살펴 봤는데, 내가 볼 수있는 것에서 볼 때 이것이 "해야"합니다. MethodExpression.invoke() 메서드가 예외를 찾을 수 없습니다.
내 코드 :.
#{reports.customer}
정보 내가 전화 한 빈에 대한 :
UIData data = (UIData)component;
fc = FacesContext.getCurrentInstance();
elc = fc.getELContext();
elFactory = fc.getApplication().getExpressionFactory();
mexp =
elFactory.createMethodExpression(elc, data.getValueExpression("value").getExpressionString(), Result.class, new Class[]{});
Object methodResult = mexp.invoke(elc, null);
은 "data.getValueExpresssion ("값 ") getExpressionString()는 문자열을 반환 (은 관련이 있는지 알 수 없음)
클래스의 관리되는 bean 이름은 "report"입니다. : 클래스 세션 범위에
클래스는 Serializable
을 내가 전화 한 방법의 액세스 한정자가
방법 내가 호출하기 위해 노력하고있어 메소드 서명에서 매개 변수가 없습니다
이다 구현
public Result getCustomer() {
Result result = null;
try {
...perform database call
} catch (Exception e) {
log.error(e);
}
return result;
}
스택 추적 발췌
SEVERE: javax.el.MethodNotFoundException: Method not found: [email protected]()
javax.faces.el.EvaluationException: javax.el.MethodNotFoundException: Method not found: [email protected]()
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:98)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:98)
at javax.faces.component.UICommand.broadcast(UICommand.java:311)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:781)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1246)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
...
Caused by: javax.el.MethodNotFoundException: Method not found: [email protected]()
at com.sun.el.util.ReflectionUtil.getMethod(ReflectionUtil.java:155)
at com.sun.el.parser.AstValue.invoke(AstValue.java:231)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
at com.npp.business.TableToExcelManager.initExcelWorker(TableToExcelManager.java:247)
at com.npp.beans.reports.SharebackReportsBean.exportToExcel(SharebackReportsBean.java:439)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.el.parser.AstValue.invoke(AstValue.java:234)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:102)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:84)
... 26 more
Mar 23, 2011 11:29:34 AM com.sun.faces.lifecycle.InvokeApplicationPhase execute
WARNING: #{reports.exportToExcel}: javax.el.MethodNotFoundException: Method not found: [email protected]()
javax.faces.FacesException: #{reports.exportToExcel}: javax.el.MethodNotFoundException: Method not found: [email protected]()
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:114)
at javax.faces.component.UICommand.broadcast(UICommand.java:311)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:781)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1246)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
이 문제에 대한 도움을 주시면 감사하겠습니다.