没用过JSF。up!
在家/公司过节的人,来看一下。
在家/公司过节的人,来看一下。
解决方案 »
- EJB能将查询结果封装为MAP吗
- java中json转换的问题
- 在jsp页面中,右下角缓缓上升出来的提醒框,是如果实现的?
- ssh更换数据库不成功?/ 在线等。。
- validator验证动态表单时出现问题
- DispatchAction问题 麻烦帮忙看看!!!
- sturts 编辑页面的时候如何赋值?
- WEBLOGIC配置JDBC连接池 问题求助
- 请问怎么样整合oc4j与jbuilder9并运行程序?
- 北京的应届毕业生,在找工作的请进!
- 在用struts上传文件是org.apache.struts.upload.formFile该怎么用啊,有这方面资料吗?
- 关于Hibernate 同一个data entry 对应 多个 Object
ApplicationFactory appFactory = (ApplicationFactory)FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
return appFactory.getApplication();
}
private static ValueBinding getValueBinding(String el) {
return getApplication().createValueBinding(el);
}
public class MyActionListener implements ActionListener{ public PhaseId getPhaseId(){
return PhaseId.INVOKE_APPLICATION;
}
public void processAction(ActionEvent event) {
System.out.println("processAction");
FacesContext facesContext=FacesContext.getCurrentInstance();
Object firstNumber=getValueBinding("numberBean.firstNumber").getValue(facesContext);
Object secondNumber=getValueBinding("numberBean.secondNumber").getValue(facesContext);
String command=event.getComponent().getId();
if (command.equals("add")){
try{
int firstNo=Integer.parseInt(firstNumber.toString());
int secondNo=Integer.parseInt(secondNumber.toString());
String result=Integer.toString(firstNo+secondNo);
System.out.println("processAction.result"+result);
getValueBinding("numberBean.result").setValue(facesContext,result);
}
catch(Exception e){
}
}else if(command.equals("subtract")){
try{
int firstNo=Integer.parseInt(firstNumber.toString());
int secondNo=Integer.parseInt(secondNumber.toString());
String result=Integer.toString(firstNo-secondNo);
System.out.println("processAction.result"+result);
getValueBinding("numberBean.result").setValue(facesContext,result);
}catch(Exception e){
}
} }
private static Application getApplication() {
ApplicationFactory appFactory = (ApplicationFactory)FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
return appFactory.getApplication();
}
private static ValueBinding getValueBinding(String valueRef){
return getApplication().createValueBinding(valueRef); //预计错误在此
}
}
运行时报错中有如下一条
javax.faces.el.ReferenceSyntaxException: numberBean.firstNumber
com.sun.faces.application.ApplicationImpl.createValueBinding(ApplicationImpl.java:281)
可能还是方法引用的错误