Xpages - going mad over a dynamic list box

I have a very simple requirement, and I am really struggling to get it working.

I have a button that puts a list of values into the request scope, and does a partial refresh on a listbox which picks up the values from the request. Except that it doesn’t.

Here is the button code…

var v = new java.util.Vector();

v.add(“TEST1”)

v.add(“TEST2”)

v.add(“TEST3”)

requestScope.put(“X”,v);

And the list box value script…

if(requestScope.get(“X”)!=null)“)!=”"){

requestScope.get(“X”);

}

If I select a full refresh on the button, it works fine, but of course all the other unsaved values on the form are wiped out, and if I choose a partial refresh then I get this error:

javax.faces.FacesException

com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:105)

com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:210)

com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:96)

com.ibm.xsp.controller.FacesControllerImpl.execute(FacesControllerImpl.java:226)

com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java:183)

com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:151)

com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:148)

com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:128)

com.ibm.xsp.webapp.DesignerFacesServlet.service(DesignerFacesServlet.java:113)

com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:354)

com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:414)

com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:508)

com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:451)

com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:343)

com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:398)

com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:143)

com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:221)

com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:183)

com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:222)

java.util.NoSuchElementException

javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:123)

javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:143)

javax.faces.component.UISelectOne.matchValue(UISelectOne.java:165)

javax.faces.component.UISelectOne.validateValue(UISelectOne.java:137)

javax.faces.component.UIInput.validate(UIInput.java:688)

com.ibm.xsp.component.UISelectOneEx.validate(UISelectOneEx.java:152)

javax.faces.component.UIInput.executeValidate(UIInput.java:893)

javax.faces.component.UIInput.processValidators(UIInput.java:453)

javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1173)

com.ibm.xsp.component.UIDataPanelBase.processValidators(UIDataPanelBase.java:300)

javax.faces.component.UIForm.processValidators(UIForm.java:194)

javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1173)

javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1173)

javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:365)

com.ibm.xsp.component.UIViewRootEx.processValidators(UIViewRootEx.java:793)

com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:97)

com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:210)

com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:96)

com.ibm.xsp.controller.FacesControllerImpl.execute(FacesControllerImpl.java:226)

com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java:183)

com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:151)

com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:148)

com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:128)

com.ibm.xsp.webapp.DesignerFacesServlet.service(DesignerFacesServlet.java:113)

com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:354)

com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:414)

com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:508)

com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:451)

com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:343)

com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:398)

com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:143)

com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:221)

com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:183)

com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:222)

I am going crazy over this, if anyone can suggest anything I would be very thankful.

Andrew

Subject: workaround

The issue is logged as SPR#MKEE7UDPB9Thanks for your investigation.

The workaround is to change your List Box values script to return “” if the value doesn’t exist yet:

if(requestScope.get(“X”)!=null){

return requestScope.get("X");

}

return “”;

Subject: Also try including a null selectItem in the list box to avoid this error…

<xp:listBox id=“listBox1”><xp:selectItem itemLabel=“Nothing Selected” itemValue=“”></xp:selectItem>

		<xp:selectItems>

			<xp:this.value><![CDATA[#{javascript:if(requestScope.get("X")!=null){

return requestScope.get("X");

}

}]]></xp:this.value>

		</xp:selectItems>

	

</xp:listBox>