RE: NullPointerException in UIComponentBase decode using Shale test framework
I figured that problem out, I needed to setRendererType, although just need to be null. Could anyone tell me why a component needs a null renderer? I have a general question though. I am trying to create a view from a jsp page, normally you would do it in a backing bean in running environment where request and everything are set. All you need to do is to call ViewHandler.createView. But in shale framework, how would i set up everything in order to make it work? Is it even possible? thanks Jane
NullPointerException in UIComponentBase decode using Shale test framework
I simply created a Form and inside an inputTextField and tried to do decoding. But I got a java.lang.NullPointerException at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:685) at javax.faces.component.UIInput.decode(UIInput.java:484) at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:905) at javax.faces.component.UIInput.processDecodes(UIInput.java:400) at com.hp.ed.configui.credential.CredentialBeanTest.testLabelUpdate(CredentialBeanTest.java:70) This has happened before, but I couldn't find an answer for that. I'm just giving it another try, as Shale test framework is really not well documented. <> UIViewRoot root=facesContext.getViewRoot(); List children = root.getChildren(); UIForm credForm = new HtmlForm(); credForm.setId("credForm"); credForm.setParent(root); UIInput label = new HtmlInputText(); label.setId("label"); label.setParent(credForm); ValueBinding vb = facesContext.getApplication().createValueBinding("#{credentialBean.passwordAgain}"); label.setValueBinding("value", vb); facesContext.getExternalContext().getRequestMap().put("credentialBean", vc); facesContext.getExternalContext().getRequestParameterMap().put("credForm.label","myLabel"); label.processDecodes(facesContext); //if I don't call label.processDecodes, but root.processDecodes, then I don't get the exception, however, the submittedValue of inputText is null. thanks for any help Jane
Failed model update
With following code, I was trying to udpate a variable in a backing bean with a HtmlInputText component in viewRoot. But the model is never updated. the value is stil the initial one. Could anyone see what went wrong here? this is from a previous post code sample. thank you so much Jane vc = new CredentialBean(); UIViewRoot root=facesContext.getViewRoot(); UIForm credForm = new HtmlForm(); credForm.setId("credForm"); credForm.setParent(root); UIInput label = new HtmlInputText(); label.setId("label"); label.setParent(credForm); ValueBinding vb = facesContext.getApplication().createValueBinding("#{credentialBean.passwordAgain}"); label.setValueBinding("value", vb); facesContext.getExternalContext().getRequestMap().put("credentialBean", vc); facesContext.getExternalContext().getRequestParameterMap().put("credForm:label","myLabel"); root.processDecodes(facesContext); root.processValidators(facesContext); root.processApplication(facesContext); root.processUpdates(facesContext); assertEquals(vc.getPasswordAgain(), "myLabel");