java - 出现错误 "org.apache.jasper.el.JspMethodNotFoundException"

标签 java jsf-2 web

我的 Web 应用程序中出现以下错误。我已经在 J​​SF 上工作了一段时间了,但是我找不到这个错误的解决方案。

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>

不知道发生了什么?如有任何帮助,我们将不胜感激。

最佳答案

我不知道发生了什么......我只是获取了项目的war文件,创建了一个新的工作区,导入了war文件并运行了项目......及其工作。

关于java - 出现错误 "org.apache.jasper.el.JspMethodNotFoundException",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20257797/

相关文章:

css - 如何将背景图像和图标添加到 JSF 按钮?

javascript - 如何在 firefox 中注入(inject) javascript 代码?

css - 为什么我们使用响应式方法,而 % 属性使我们的页面适应任何屏幕尺寸?

JavaScript/网络开发 : Why do you need a server to connect to hardware?

java - 描述 服务器遇到内部错误 (),导致其无法完成此请求

java - 如何构建在 java 中动态调整大小的布局?

java - 什么会使 .app 包无法在双击时启动 shell 脚本文件

java - 在与声明不同的位置初始化的字符串

jsf-2 - 用于静态内容或普通静态文件的 JSF 库的性能?

java - 如何将EAR包划分为模块