My Idea/Requirement is to render dynamically generated jsf page and bind/capture the user filled data and save into db. Dynamically rendering part is working fine but not able to capture the user filled data back to my managedbean. I am using Jsf 2.1.
LoginManagedBean.java (requestscoped)
private String fieldName;
//getters and setters
public String trytry()
{
HtmlInputText inputText = (HtmlInputText) FacesContext.getCurrentInstance().getApplication().createComponent(HtmlInputText.COMPONENT_TYPE);
inputText.setId("it");
inputText.setValueExpression("value", FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(),"#{loginmb.keyValueMap['" + inputText.getId() + "']}", String.class));
panelGroupChilds.add(inputText);
grid.getChildren().add(panelGroupTextbox);
return "done";
}
public String save() {
System.out.println("fieldName --- " + this.fieldName);
return "save";
}
done.xhtml (dynamically rendered page)
<h:panelGrid binding="#{loginmb.docGridElems}"></h:panelGrid>
<h:commandButton id="cndB" value="SAVE" action="#{loginmb.save()}"></h:commandButton>
I am able to see the rendered textbox in done.xhtml but on submit the save button, I am not able to get the value of "feildName" (it is null). I am not able to find where i went wrong.
I even tried to bind the Map but could not able to get it.