This looks like a very bad idea to me. If
there are a limited number of answer component-types (from a quick glance at
your code I see htmlSelectMany, One, Boolean) why not just have all those
component types and control whether or not they are shown with the “rendered”
attribute. Afaic this is the preferred way to dynamically render components. Example in psuedo JSF: <h:dataTable
var=”questionAnswerPair” value=”#{qaBean.questionAnswerPairs}”>
<h:column>
<%-- Question logic --%>
</h:column>
<h:column>
<component1 … rendered=”#{questionAnswerPair.isRenderComponentType1}”/>
<component2 … rendered=”#{questionAnswerPair.isRenderComponentType2}”/>
<component3 … rendered=”#{questionAnswerPair.isRenderComponentType3}”/>
</h:column> <h:dataTable> From:
ved.gunjan [mailto:[EMAIL PROTECTED] Hi Experts, Here's my requirment.... I'have to display listing of questions and associated answers in the
variety of different UIComponents. These questions and the control type(UIComponent) are not known at the
compile time,so i cant create them on the jsp page. Questions and its associated control type(UIComponent) ,for the
answers,are know at the run-time. So i have to dynamically generate these UIComponent in the
<h:datatable or rather to say in other words i've to dynamically create this
datatable. Here's my jsp -------------------- <f:view> <h:form id="form1"> <h:commandButton value="Create
Controls" id="commandButton1" type="submit"
action="#{dynamicQuestions.createQuestionControlAction}" /> <h:dataTable binding="#{dynamicQuestions.dataTable}" value="#{requirementBean.questionList}" var="questions"
border="1" id="RootTable"
/> </h:form> </f:view> ------------------- The java method Application application =
FacesContext.getCurrentInstance().getApplication(); Right now im trying to only create these UIComponents , just for
testing purpose.. HtmlSelectManyListbox ,HtmlSelectOneMenu,HtmlOutputText But when i pressed the CreateControls button nothing happens i.e there
is no output. Please guide me as to where im going wrong and what is the correct way
of creating a dynamic datatable. Waiting for the experts reply... Thanks Ved __________________________________________________
|
- RE: Creating Dynamic h:datatable Dhananjay Prasanna
- RE: Creating Dynamic h:datatable ved.gunjan