Failed model update

View: New views
1 Messages — Rating Filter:   Alert me  

Failed model update

by Zhen, Jane :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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");
LightInTheBox - Buy quality products at wholesale price