我的Web应用程序中出现以下错误。我已经在JSF工作了很长一段时间,但我无法找到解决这个错误的方法。
Nov 27, 2013 11:00:52 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: servlet.service() for servlet Faces Servlet threw exception
org.apache.jasper.el.JspMethodNotFoundException: /CustomerPFM.jsp(70,2) '#customerPfmBean.MakeConnections}' Method not found: bean.CustomerPfmBean@1900abac.MakeConnections()
这是我的JSP
CustomerPFM.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Allocate PM Success</title>
</head>
<body>
<f:view>
<h:form>
<h3> Customers</h3>
<h:dataTable border="1" value="#{customerPfmBean.customerDetails}" var="cust">
<h:column id="column1">
<h:outputText value="#{cust.id}"></h:outputText>
<f:facet name="header">
<h:outputText value="Customer ID"></h:outputText>
</f:facet>
</h:column>
<h:column id="column2">
<h:outputText value="#{cust.customerName }"></h:outputText>
<f:facet name="header">
<h:outputText value="Customer Name"></h:outputText>
</f:facet>
</h:column>
</h:dataTable>
<h3>Portfolio Managers</h3>
<h:dataTable border="1" value="#{customerPfmBean.pfmDetails}" var="pfm">
<h:column id="column1">
<h:outputText value="#{pfm.id}"></h:outputText>
<f:facet name="header">
<h:outputText value="Portfolio Manager ID"></h:outputText>
</f:facet>
</h:column>
<h:column id="column2">
<h:outputText value="#{pfm.pfmName}"></h:outputText>
<f:facet name="header">
<h:outputText value="Portfolio Manager Name"></h:outputText>
</f:facet>
</h:column>
</h:dataTable>
<h3>Active Portfolio Managers Allocations</h3>
<h:dataTable border="1" value="#{customerPfmBean.customerPfms }" var="cp">
<h:column id="column1">
<h:outputText value="#{cp.id.pfmUser}"></h:outputText>
<f:facet name="header">
<h:outputText value="PortFolio Manager ID"></h:outputText>
</f:facet>
</h:column>
<h:column id="column2">
<h:outputText value="#{cp.id.custUser}"></h:outputText>
<f:facet name="header">
<h:outputText value="Customer ID"></h:outputText>
</f:facet>
</h:column>
</h:dataTable>
<h:panelGrid columns="3">
<h:outputText value="Enter the Customer Id"></h:outputText>
<h:inputText value="#{customerPfmBean.custId}" id="custId" required="true" requiredMessage="*Cant be left blank"></h:inputText>
<h:message for="custId" style="color: #FF0000"></h:message>
<h:outputText value="Enter the Portfolio Manager Id"></h:outputText>
<h:inputText value="#{customerPfmBean.pmId}" id="pmId" required="true" requiredMessage="*Cant be left blank"></h:inputText>
<h:message for="pmId" style="color: #FF0000"></h:message>
<h:commandButton value="Connect Customer to PM" type="submit" action="#{customerPfmBean.MakeConnections}"></h:commandButton>
<h:commandButton value="Reset" type="reset"></h:commandButton></h:panelGrid><br><br>
<h:outputText value="#{customerPfmBean.message}" style="color: #FF0000"></h:outputText><br>
<h:outputLink value="AdminWelcomePage.jsp">Home</h:outputLink><br>
<h:commandLink action="#{logout.logout}">LogOut</h:commandLink>
</h:form>
</f:view>
</body>
</html>
我的托管Bean 的 CustomerPFM.java
package bean;
import java.util.ArrayList;
import java.util.List;
import service.CustomerPFMService;
import service.CustomerService;
import service.PMService;
import model.CustomerDetail;
import model.CustomerPfm;
import model.PfmDetail;
public class CustomerPfmBean {
private String custId;
private String pmId;
private List<PfmDetail> pfmDetails;
private List<CustomerDetail> customerDetails;
private List<CustomerPfm> customerPfms;
private String message;
public String getCustId() {
return custId;
}
public void setCustId(String custId) {
this.custId = custId;
}
public String getPmId() {
return pmId;
}
public void setPmId(String pmId) {
this.pmId = pmId;
}
public List<PfmDetail> getPfmDetails() {
return pfmDetails;
}
public void setPfmDetails(List<PfmDetail> pfmDetails) {
this.pfmDetails = pfmDetails;
}
public List<CustomerDetail> getCustomerDetails() {
return customerDetails;
}
public void setCustomerDetails(List<CustomerDetail> customerDetails) {
this.customerDetails = customerDetails;
}
public List<CustomerPfm> getCustomerPfms() {
return customerPfms;
}
public void setCustomerPfms(List<CustomerPfm> customerPfms) {
this.customerPfms = customerPfms;
}
public String getAllCustPM()
{
this.customerDetails=new ArrayList<CustomerDetail>();
this.pfmDetails=new ArrayList<PfmDetail>();
this.customerPfms=new ArrayList<CustomerPfm>();
this.customerDetails=new CustomerService().getAllCustomer();
this.pfmDetails = new PMService().getAllPM();
if((customerDetails.size()==0) || pfmDetails.size()==0)
{
return "cust-pm-fail";
}
else
{
this.customerPfms=new CustomerPFMService().getALLCustomerandPFM();
return "cust-pm-success";
}
}
public String MakeConnections()
{
int cid= Integer.parseInt(this.custId);
int pid= Integer.parseInt(this.pmId);
CustomerPFMService service= new CustomerPFMService();
String saveMessage= service.save(cid, pid);
if(saveMessage.equals("cust-fail"))
{
this.message="Customer does not exist";
return "cust-fail";
}
else if (saveMessage.equals("pm-fail"))
{
this.message="PM does not exist";
return "pm-fail";
}
else if (saveMessage.equals("pm-exist-fail"))
{
this.message="Already allocated customer to PM";
return "pm-exist-fail";
}
else
{
this.message="";
this.custId="";
this.pmId="";
return "success";
}
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
我的faces.config文件
<managed-bean>
<managed-bean-name>customerPfmBean</managed-bean-name>
<managed-bean-class>bean.CustomerPfmBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<navigation-rule>
<display-name>CustomerPFM</display-name>
<from-view-id>/CustomerPFM.jsp</from-view-id>
<navigation-case>
<from-outcome>cust-fail</from-outcome>
<to-view-id>/CustomerPFM.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<display-name>CustomerPFM</display-name>
<from-view-id>/CustomerPFM.jsp</from-view-id>
<navigation-case>
<from-outcome>pm-fail</from-outcome>
<to-view-id>/CustomerPFM.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<display-name>CustomerPFM</display-name>
<from-view-id>/CustomerPFM.jsp</from-view-id>
<navigation-case>
<from-outcome>pm-exist-fail</from-outcome>
<to-view-id>/CustomerPFM.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<display-name>CustomerPFM</display-name>
<from-view-id>/CustomerPFM.jsp</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/CustomerPFMSucess.jsp</to-view-id>
</navigation-case>
</navigation-rule>
不知道发生了什么?任何帮助表示赞赏。
答案 0 :(得分:0)
我不知道发生了什么......我只是拿了项目的war文件,创建了一个新的工作区,导入war文件运行项目....及其工作。