myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeroen Verhagen" <jeroenverha...@gmail.com>
Subject Problem creating custom component: IndexOutOfBoundsException
Date Sun, 02 Dec 2007 19:59:47 GMT
Hi all,

I using myfaces 1.2.0 to create a custom component that consist of
standard components. My problem is that this custom component renders
ok but when I submit the form that contains it I get an
IndexOutOfBoundsException.

Can anyone please tell me what's causing this or what's the problem?

Here's the exception:

java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
        at java.util.ArrayList.RangeCheck(ArrayList.java:546)
        at java.util.ArrayList.get(ArrayList.java:321)
        at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:740)
        at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:743)
        at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:743)
        at org.apache.myfaces.application.jsp.JspStateManagerImpl.restoreView(JspStateManagerImpl.java:300)
        at org.apache.myfaces.application.jsp.JspViewHandlerImpl.restoreView(JspViewHandlerImpl.java:354)
        at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:85)
        at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
        at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
....

And here's the custom component code:

	public UIBooleanFieldset() {
		setConverter(new BooleanConverter());
		setRendererType(null);

		Application application = FacesContext.getCurrentInstance().getApplication();
		HtmlSelectOneRadio htmlSelectOneRadio = (HtmlSelectOneRadio)
application.createComponent(HtmlSelectOneRadio.COMPONENT_TYPE);

		htmlSelectOneRadio.setId(getId() + "_radios");
		ValueBinding radioBinding =
application.createValueBinding("#{persoonBean.sex}");
		htmlSelectOneRadio.setValueBinding("value", radioBinding);
		htmlSelectOneRadio.setLayout("pageDirection");

		UISelectItems selectItems = (UISelectItems)
application.createComponent(UISelectItems.COMPONENT_TYPE);
		ValueBinding selectBinding =
application.createValueBinding("#{persoonBean.sexItems}");
		selectItems.setValueBinding("value", selectBinding);

		htmlSelectOneRadio.getChildren().add(selectItems);
		getChildren().add(htmlSelectOneRadio);
	}


Thanks for any help!


-- 

regards,

Jeroen

Mime
View raw message