You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Lance Frohman (JIRA)" <de...@myfaces.apache.org> on 2006/07/02 18:04:30 UTC

[jira] Resolved: (MYFACES-1349) selectonelistbox inside datatable crashes

     [ http://issues.apache.org/jira/browse/MYFACES-1349?page=all ]
     
Lance Frohman resolved MYFACES-1349:
------------------------------------

    Resolution: Fixed

(Unbelievable) Oversight - there is no setter for item1 in TestUnit.
Please close this issue (and pretend it never happened).


> selectonelistbox inside datatable crashes
> -----------------------------------------
>
>          Key: MYFACES-1349
>          URL: http://issues.apache.org/jira/browse/MYFACES-1349
>      Project: MyFaces Core
>         Type: Bug

>     Versions: 1.1.3
>     Reporter: Lance Frohman
>      Fix For: 1.1.3

>
> I have a selectonelistbox inside a datatable. When I submit the form, I get a
> 17:12:02,640 DEBUG PropertyResolverImpl:177 - Exception while setting property; base with class : TestUnit, property : item1
> javax.faces.el.PropertyNotFoundException: Bean: TestUnit, property: item1
> 	at org.apache.myfaces.el.PropertyResolverImpl.setProperty(PropertyResolverImpl.java:391)
> 	at org.apache.myfaces.el.PropertyResolverImpl.setValue(PropertyResolverImpl.java:173)
> 	at org.apache.myfaces.el.ValueBindingImpl.setValue(ValueBindingImpl.java:275)
> 	at javax.faces.component.UIInput.updateModel(UIInput.java:269)
> . . .
> for the value of the selectonelistbox. Note, the exception only prints out when the
> log4j.properties is set to debug, otherwise I don't get any information why it
> doesn't work. Also, I have the same problem with <h:inputhidden>.
> test.jsp
> ================
> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
> <f:view>
> 	<html>
> 		<body>
> 			<h:form id="test">
> 				<h:dataTable var="unit" value="#{testBean.units}">
> 					<h:column>
> 						<h:outputText value="#{unit.item2}"></h:outputText>
> 						<h:selectOneListbox value="#{unit.item1}" size="1">
> 							<f:selectItems value="#{unit.items1}" />
> 						</h:selectOneListbox>
> 					</h:column>
> 				</h:dataTable>
> 				<h:commandButton value="submit" action="#{testBean.processForm}" />
> 			</h:form>
> 		</body>
> 	</html>
> </f:view>
> ================
> TestBean.java
> ================
> import java.io.Serializable;
> import java.util.ArrayList;
> import java.util.List;
> import javax.faces.model.DataModel;
> import javax.faces.model.ListDataModel;
> public class TestBean implements Serializable {
> 	private static final long serialVersionUID = 1L;
> 	private DataModel units;
> 	public TestBean() {
> 		List unitList = new ArrayList();
> 		unitList.add(new TestUnit());
> 		units = new ListDataModel();
> 		units.setWrappedData(unitList);
> 	}
> 	public DataModel getUnits() {
> 		return units;
> 	}
> 	public void processForm() {
> 		System.out.println("processForm");
> 	}
> }
> ================
> TestUnit.java
> ================
> import java.io.Serializable;
> import javax.faces.model.SelectItem;
> public class TestUnit implements Serializable {
> 	private static final long serialVersionUID = 1L;
> 	public TestUnit() {
> 		super();
> 	}
> 	public String getItem1() {
> 		return "1";
> 	}
> 	public String getItem2() {
> 		return "2";
> 	}
> 	public SelectItem[] getItems1() {
> 		SelectItem[] items1 = new SelectItem[5];
> 		int loop = 0;
> 		items1[loop] = new SelectItem("" + loop, "");
> 		for (loop = 1; loop < 5; loop++) {
> 			items1[loop] = new SelectItem("" + loop, "" + loop);
> 		}
> 		return items1;
> 	}
> }
> ================

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira