开发者

JSF 1.2 on Websphere 7.0.0.9 : backing beans' property not found

I'm working on JSF1.2 + EJB3.0 + Websphere 7.0.0.3. The whole business logic layer and Data layer (EJB 3.0) are tested and work successfully from the beginning. After I integrated JSF1.2, I got these errors when I tried to get some data from database:

E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: Uncaught exception created in one of the service methods of the servlet Faces Servlet in application de.rwth.swc.ejb.generator.prototype.muster.ear. Exception created : javax.servlet.ServletException: /modelroot.jsp(19,5) '#{modelRootBean.getCustomers}' The class 'de.rwth.swc.ejb.generator.prototype.muster.client.backingbeans.ModelRootBean' does not have the property 'getCustomers'.
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1655)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:937)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:500)
    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:341)
    at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:564)
    at com.ibm._jsp._index._jspService(_index.java:93)
    at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:98)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1655)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:937)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:500)
    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
    at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:121)
    at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:239)
    at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionProcessor.handleRequest(AbstractJSPExtensionProcessor.java:340)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:341)
    at com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:709)
    at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3810)
    at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931)
    at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:183)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:272)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
    at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1550)
Caused by: org.apache.jasper.el.JspPropertyNotFoundException: /modelroot.jsp(19,5) '#{modelRootBean.getCustomers}' The class 'de.rwth.swc.ejb.generator.prototype.muster.client.backingbeans.ModelRootBean' does not have the property 'getCustomers'.
    at org.apache.jasper.el.JspValueExpression.getValue(JspValueExpression.java:103)
    at javax.faces.component.UIData.getValue(UIData.java:608)
    at javax.faces.component.UIData.getDataModel(UIData.java:1112)
    at javax.faces.component.UIData.setRowIndex(UIData.java:450)
    at com.ibm.faces.renderkit.html_extended.DataTableRenderer.encodeChildren(DataTableRenderer.java:961)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:826)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:936)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:942)
    at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:289)
    at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:220)
    at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
    at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
    ... 36 more

These are my artifacts :

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" 
        version="2.5" 
        xmlns="http://java.sun.com/xml/ns/javaee" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    <display-name>
    de.rwth.swc.ejb.generator.prototype.muster.client</display-name>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    <servlet>
        <display-name>FacesServlet</display-nam开发者_Go百科e>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
        <servlet-name>JavaScript Resource Servlet</servlet-name>
        <servlet-class>com.ibm.faces.webapp.JSResourceServlet</servlet-class>
        <load-on-startup>-1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
        <url-pattern>
        /faces/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>  
        <servlet-name>Faces Servlet</servlet-name>  
        <url-pattern>*.faces</url-pattern>  
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>JavaScript Resource Servlet</servlet-name>
        <url-pattern>
        /.ibmjsfres/*</url-pattern>
    </servlet-mapping> 
      <context-param>  
        <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>  
        <param-value>resources.application</param-value>  
      </context-param>
      <context-param>

        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>server</param-value>
      </context-param>
      <context-param>

        <param-name>javax.faces.CONFIG_FILES</param-name>
        <param-value>/WEB-INF/faces-config.xml</param-value>
      </context-param>
      <context-param>

        <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
        <param-value>.jsp</param-value>
      </context-param>
      <context-param>

        <param-name>com.ibm.ws.jsf.JSP_UPDATE_CHECK</param-name>
        <param-value>true</param-value>
      </context-param>
      <context-param>

        <param-name>com.ibm.ws.jsf.LOAD_FACES_CONFIG_AT_STARTUP</param-name>
        <param-value>true</param-value>
      </context-param>
      <context-param>

        <param-name>com.ibm.faces.DISABLE_JWL_MULTIPART_CONTEXT</param-name>
        <param-value>false</param-value>
      </context-param>
      <context-param>

        <param-name>com.ibm.faces.RESOURCE_EXPIRE_MS</param-name>
        <param-value>31536000000</param-value>
      </context-param>
      <context-param>

        <param-name>com.ibm.faces.DATETIME_ASSIST_STRICTNESS</param-name>
        <param-value>1</param-value>
      </context-param>
      <context-param>

        <param-name>com.ibm.faces.NUMBER_ASSIST_STRICTNESS</param-name>
        <param-value>1</param-value>
      </context-param>
      <context-param>

        <param-name>com.ibm.faces.USE_UNENCODED_CONTEXT_PATH</param-name>
        <param-value></param-value>
      </context-param>
      <context-param>

        <param-name>com.ibm.faces.JS_RESOURCE_SERVLET_URL_PATTERN</param-name>
        <param-value>/.ibmjsfres/*</param-value>
      </context-param>
      <context-param>

        <param-name>com.ibm.faces.JS_RESOURCE_SERVLET_CACHE</param-name>
        <param-value>false</param-value>
      </context-param>
      <context-param>

        <param-name>com.ibm.faces.ENCODING_MAPPING</param-name>
        <param-value>converter.properties</param-value>
      </context-param>
      <context-param>

        <param-name>com.ibm.faces.USE_HXCLIENT_FULL</param-name>
        <param-value>false</param-value>
      </context-param>
      <context-param>

        <param-name>com.ibm.faces.MAX_REQUEST_CONTENT_SIZE</param-name>
        <param-value>0</param-value>
      </context-param>  
      <listener>  
        <listener-class>com.sun.faces.config.ConfigureListener</listener-class>  
      </listener>  

    </web-app>

faces-config.xml

<?xml version="1.0"?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
                              "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
 <managed-bean>
  <managed-bean-name>modelRootBean</managed-bean-name>
  <managed-bean-class>de.rwth.swc.ejb.generator.prototype.muster.client.backingbeans.ModelRootBean</managed-bean-class>
  <managed-bean-scope>request</managed-bean-scope>
 </managed-bean>
</faces-config>

modelroot.jsp

<%@ page language="java" import="java.util.*" %>
<%@ page language="java" import="java.net.*" %>
<%@ page import="de.rwth.swc.ejb.generator.prototype.muster.domain.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@page
    language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<html>  
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title>Customer-Contract Management System</title>
    </head>
    <body>
        <h1>Customer-Contract Management</h1>
        <f:view>
            <h2>Customer List</h2>
                <h:dataTable id="dt_customer_list" value="#{modelRootBean.getCustomers}" var="item" bgcolor="#F1F1F1" border="10" cellpadding="5" cellspacing="3" rows="4" width="50%" dir="LTR" frame="hsides" rules="all">

                <h:column>
                <f:facet name="header">
                <h:outputText value="Name" />
                </f:facet> 
                <h:outputText style="" value="#{item.name}" ></h:outputText>
                </h:column>

                <h:column>
                <f:facet name="header">
                <h:outputText value="Edit"/>
                </f:facet> 
                <!-- <h:outputText value="#{item.lastName}"></h:outputText> -->
                </h:column>

                <f:facet name="footer">
                <h:outputText value="The End" />
                </f:facet> 

            </h:dataTable>
            <h2>Contract List</h2>

        </f:view>
    </body>
</html>

ModelRootBean (backingbean)

package de.rwth.swc.ejb.generator.prototype.muster.client.backingbeans;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.ejb.EJB;

import de.rwth.swc.ejb.generator.prototype.muster.controller.ModelRootControllerBean;
import de.rwth.swc.ejb.generator.prototype.muster.domain.Contract;
import de.rwth.swc.ejb.generator.prototype.muster.domain.Customer;

public class ModelRootBean implements Serializable{

    private List<Customer> customers;
    private List<Contract> contracts;

    @EJB
    private ModelRootControllerBean modelRootControllerBean;

    public ModelRootBean()  {
        customers = new ArrayList<Customer>();
        contracts = new ArrayList<Contract>();
    }

    public List<Customer> getCustomers() {
        customers = modelRootControllerBean.getAllCustomer();
    }

    public void setCustomers(List<Customer> customers) {
        this.customers = customers;
    }

    public List<Contract> getContracts() {
        //contracts = modelRootControllerBean.getAllContracts();
        return contracts;
    }

    public void setContracts(List<Contract> contracts) {
        this.contracts = contracts;
    }
}

I'm quite sure that this error might come from my stupid mistake but I couldn't figure it out. Can someone help me out?


Just replace

value="#{modelRootBean.getCustomers}"

with

value="#{modelRootBean.customers}"


Use modelRootBean.customers instead of modelRootBean.getCustomers.

ManagedBean properties have to be called without "get" prefix in jsf.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜