Quick-Tip: "You must provide an item name" - possible cause

Friday, July 8, 2016 at 10:20 AM UTC

These appear to be the "quick tip days" now. This is the third post in a row. This time I stumbled upon a very strange thing: While executing a simple save action from the XSP document I got the exception "You must provide an item name". Once I moved the document save in my bean and removed the simple action I was able to track the stack trace down to a native method from the XSP runtime - lucky me that it wasn't from my own code, but on the other hand this didn't give me a chance to work it around. Here is the stacktrace I got:

Error while saving document at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:102) at 
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:210) at 
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:96) at 
com.ibm.xsp.controller.FacesControllerImpl.execute(FacesControllerImpl.java:256) at 
com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java:228) at 
com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:157) at 
com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:160) at 
com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:138) at 
com.ibm.xsp.webapp.DesignerFacesServlet.service(DesignerFacesServlet.java:103) at 
com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:588) at 

As you can see, it's all "home made" stuff. Of course there are several other causes for this, e.g. an empty fieldname in getItemValue or replaceItemValue methods.

The problem only occurred after a partial refresh which was triggered from one of my elements on the page (here it was a drag-and-drop area). After I tested several things (which took me several hours) I had a closer look at this partial refresh. The drag-and-drop script finally issued that partial refresh using the XSP.partialRefreshPost method. The refresh ID that was used somehow was not found on my page. Usually I'd have expected an error when referencing a partial refresh ID that's not there but it seems that this method ignores that. To be clear: there was a refresh event, values and texts were refreshed - so it was executed. As I mentioned before: after that refresh the save action failed.

I finally changed the refresh ID to an existing ID on my page - and et voilá, the exception was never seen again.


If you ever stumble upon this problem, check your refresh IDs being used!