0 Replies Latest reply on Nov 29, 2007 10:29 AM by amer sohail

    javax.faces.FacesException: Error performing conversion of v

    amer sohail Newbie

      I am facing the following error:
      javax.faces.FacesException: Error performing conversion of value ' of type class java.lang.String to type class com.vahzay.AssetVO for managed bean AssetBean.

      For reference managed bean, faces-config.xml and .xhtml file are below:
      public class AssetBean
      {
      private AssetVO[] assets;

      public AssetBean()
      {
      assets = new AssetVO[1];
      assets[0] = new AssetVO();
      assets[0].setIdentifier("12345");
      assets[0].setContractNumber("464564");
      assets[0].setDescription("Machine");
      assets[0].setModelNumber("546875");
      assets[0].setOrganizationName("Vazhay Ltd.");


      }

      public AssetVO[] getAssets() {
      return assets;
      }

      public void setAssets(AssetVO[] assets) {
      this.assets = assets;
      }
      }

      public class AssetVO {
      private long id;
      private java.lang.String identifier;
      private java.lang.String description;
      private java.lang.String organizationName;
      private java.lang.String modelNumber;
      private java.lang.String contractNumber;

      public java.lang.String getIdentifier() {
      return identifier;
      }
      public void setIdentifier(java.lang.String identifier) {
      this.identifier = identifier;
      }
      public java.lang.String getDescription() {
      return description;
      }
      public void setDescription(java.lang.String description) {
      this.description = description;
      }
      public java.lang.String getOrganizationName() {
      return organizationName;
      }
      public void setOrganizationName(java.lang.String organizationName) {
      this.organizationName = organizationName;
      }
      public long getId() {
      return id;
      }
      public void setId(long id) {
      this.id = id;
      }
      public java.lang.String getContractNumber() {
      return contractNumber;
      }
      public void setContractNumber(java.lang.String contractNumber) {
      this.contractNumber = contractNumber;
      }

      public java.lang.String getModelNumber() {
      return modelNumber;
      }

      public void setModelNumber(java.lang.String modelNumber) {
      this.modelNumber = modelNumber;
      }

      <faces-config version="1.2"
      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-facesconfig_1_2.xsd">


      <view-handler>
      com.sun.facelets.FaceletViewHandler
      </view-handler>

      <managed-bean>
      <managed-bean-name>AssetBean</managed-bean-name>
      <managed-bean-class>com.vahzay.AssetBean</managed-bean-class>
      <managed-bean-scope>session</managed-bean-scope>
      <managed-property>
      <property-name>assets</property-name>
      <property-class>com.vahzay.AssetVO</property-class>

      </managed-property>
      </managed-bean>


      <navigation-rule>
      <from-view-id>/template-client.xhtml</from-view-id>
      <navigation-case>
      <from-outcome>assets</from-outcome>
      <to-view-id>/assets.xhtml</to-view-id>
      </navigation-case>
      </navigation-rule>
      </faces-config>

      <html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich">



      This text above will not be displayed.

      <ui:composition template="/template.xhtml">

      This text will not be displayed.

      <ui:define name="title">
      Facelets
      </ui:define>

      This text will also not be displayed.

      <ui:define name="body">
      <h:form>
      <rich:spacer height="100" />
      <rich:panel>
      <f:facet name="header">
      Maintain Assets
      </f:facet>
      <rich:datascroller align="left" for="assetList" maxPages="20" />
      <rich:spacer height="30" />
      <rich:dataTable width="483" id="assetList" rows="4" columnClasses="col"
      value="#{AssetBean.assets}" var="assets">
      <f:facet name="header">
      <rich:columnGroup>
      <h:column>
      <h:outputText styleClass="headerText" value="Identifier" />
      </h:column>
      <h:column>
      <h:outputText styleClass="headerText" value="Description" />
      </h:column>
      <h:column>
      <h:outputText styleClass="headerText" value="Manufacture" />
      </h:column>
      <h:column>
      <h:outputText styleClass="headerText" value="Model" />
      </h:column>
      <h:column>
      <h:outputText styleClass="headerText" value="Contract" />
      </h:column>
      </rich:columnGroup>
      </f:facet>
      <h:column>
      <h:outputText value="#{assets.identifier}" />
      </h:column>
      <h:column>
      <h:outputText value="#{assets.description}" />
      </h:column>
      <h:column>
      <h:outputText value="#{assets.organizationName}" />
      </h:column>
      <h:column>
      <h:outputText value="#{assets.modelNumber}" />
      </h:column>
      <h:column>
      <h:outputText value="#{assets.contractNumber}" />
      </h:column>
      </rich:dataTable>
      </rich:panel>
      </h:form>
      </ui:define>
      This text will not be displayed.
      </ui:composition>
      This text below will also not be displayed.