Creating jsf component dynamically and binding back to a ManagedBean -
my idea/requirement render dynamically generated jsf page , bind/capture user filled data , save db. dynamically rendering part working fine not able capture user filled data managedbean. using jsf 2.1.
loginmanagedbean.java (requestscoped) private string fieldname; //getters , 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 able see rendered textbox in done.xhtml on submit save button, not able value of "feildname" (it null). not able find went wrong.
i tried bind map not able it.
Comments
Post a Comment