myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Khai Wan <ipohs...@yahoo.com>
Subject <h:selectOneListbox>
Date Tue, 18 Apr 2006 20:06:59 GMT

Hello,

I have a problem of which I could not figure out why. I am currently using
the following:

(a) jar files

commons-beanutils-1.7.0.jar
commons-codec-1.3.jar
commons-collections-3.1.jar
commons-dbcp-1.2.1.jar
commons-digester-1.7.jar
commons-el-1.0.jar
commons-lang-2.1.jar
commons-logging-1.0.4.jar
commons-pool-1.2.jar
el-api-1.0.jar
el-ri-1.0.jar
jsf-facelets-1.1.2.jar
jstl-1.1.0.jar
log4j-1.2.13.jar
myfaces-api-1.1.3-SNAPSHOT.jar
myfaces-impl-1.1.3-SNAPSHOT.jar
myfaces-shared-impl-2.0.1-SNAPSHOT.jar
xercesImpl-2.0.2.jar
xml-apis-1.0.b2.jar

(b) test.xhtml
 
      <h:form id="dummy">
            <h:selectOneListbox size="1" 
                                value="#{myform.data}">
              <f:selectItems value="#{myform.dataItems}"/>
            </h:selectOneListbox>
            <h:commandButton action="#{myform.execute}"
                             id="button"
                             value="Press"/>
      </h:form>

(c) faces-config.xml

  <managed-bean>
    <managed-bean-name>myform</managed-bean-name>
    <managed-bean-class>com.arc.MyForm</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
    <managed-property>    
  </managed-bean>

(d) MyForm.java

package com.arc;
import javax.faces.model.SelectItem;

public class MyForm
{
  private String data;
  private SelectItem[] dataItems;

  public MyForm()
  {
    dataItems = new SelectItem[2];
    dataItems[0] = new SelectItem("1","one");
    dataItems[1] = new SelectItem("2","two");
  }

  public SelectItem[] getDataItems()
  {
    return dataItems;
  }

  public void setDataItems(SelectItem[] value)
  {
    dataItems = value;
  }

  public String getData()
  {
    return data;
  }

  public void setData(String value)
  {
    data = value;
  }

  public String execute()
  {
    return "success";
  }
}
  
(e) jetty 6

I am using jett 6 and jdk 1.5.

(f) Internet Explorer

When I test out the above code, the browser shows a listing of items. When I
press the button, myfaces throws the following exception:


HTTP ERROR: 500
Value binding '#{myform.dataItems}'of UISelectItems with component-path
{Component-Path : 
[Class: javax.faces.component.UIViewRoot,ViewId: /app/test.xhtml]
[Class: javax.faces.component.html.HtmlForm,Id: dummy]
[Class: javax.faces.component.html.HtmlSelectOneListbox,Id: _id23]
[Class: javax.faces.component.UISelectItems,Id: _id24]} does not reference
an Object of type SelectItem, SelectItem[], Collection or Map but of type :
null


Hope someone seen this before. Would appreciate very much for any help.

Thanks,
Khai Wan

--
View this message in context: http://www.nabble.com/%3Ch%3AselectOneListbox%3E-t1470396.html#a3975697
Sent from the My Faces - Dev forum at Nabble.com.


Mime
View raw message