我真的不知道问题的原因是什么。我用hibenate和JSF创建了一个网站,后来决定整合Spring框架,但最终遇到了问题。
我的托管bean“loginbean”运行正常。它还识别JSF页面中的方法,但是当我运行应用程序时,我看到“错误删除”消息。
我的豆子:
@ManagedBean(name="loginBean")
@SessionScoped
public class LoginBean {
private String username;
private String password;
private int activeindex;
public String Dirige(int a){
setActiveindex(a);
if (a == 0){
return "/Menu.jsf";
}else{
if (a == 1) {
return "/pagess/pagesFabricant/Fabricant.jsf";
}else{
if (a == 2) {
return "/pagess/pagesComposant/Composant.jsf";
}else{
if(a == 3){
return "/pagess/pagesDeq/DEQ.jsf";
}
}
}
}
return null;
}
}
我在faces-config.xml中添加了SpringBeanFacesELResolver
:
<application>
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
</application> on faces.config.xml
我还在web.xml中包含了相关的监听器:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/application.xml
</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<listener>
<listener-class>
org.springframework.web.context.request.RequestContextListener
</listener-class>
</listener>
我的观点:
<p:tabMenu activeIndex="#{loginBean.activeindex}">
<p:menuitem value="Home" icon="ui-icon-star" action="#{loginBean.Dirige(0)}" />
<p:menuitem value="Fabricants" icon="ui-icon-wrench" action="#{loginBean.Dirige(1)}" />
<p:menuitem value="Composants" icon="ui-icon-search" action="#{loginBean.Dirige(2)}"/>
<p:menuitem value="Dossier d'equivalence" icon="ui-icon-document" action="#{loginBean.Dirige(3)}"/>
</p:tabMenu>
最后这是我得到的错误:
Grave: javax.el.MethodNotFoundException: /templates/template.xhtml @42,95 action="#{loginBean.Dirige(1)}": Method not found: com.ardia.beans.LoginBean@1af73b2.Dirige(java.lang.Long)
javax.faces.el.MethodNotFoundException: javax.el.MethodNotFoundException: /templates/template.xhtml @42,95 action="#{loginBean.Dirige(1)}": Method not found: com.ardia.beans.LoginBean@1af73b2.Dirige(java.lang.Long)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:92)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at javax.faces.component.UICommand.broadcast(UICommand.java:315)
答案 0 :(得分:0)
问题是 我在另一个tomcat服务器 启动应用程序..它运行良好它接受带参数的bean方法
感谢您的合作