just put UIInput components whereever you want them.
 
For example,
    instead of
        <h:outputText value="#{rowVar.radical_value}"/>,
    use
        <h:inputText id="text4" value="#{rowVar.radical_value}" />
If templatesCollection is a session-managed bean there would be no problem for inputting values.
 
Regards,
 
Mert.

 
On 5/2/06, James Ellis <[EMAIL PROTECTED]> wrote:
I want to have a datatable with two columns.  The first column will always
be text, but the second column will have some sort of form element (textbox,
textarea, dropdown box etc) populated dynamically.  How do I populate the
datatable dynamically?

I tried the code below but all I got was the name of the class of the form
element (since it's toString method must have been called):

(from JSF page)

<h:dataTable id="dynSourceTable" columnClasses="label" headerClass="label"
value="#{dynSourceTemplateBean.templatesCollection}" var="rowVar"
border="0">
       <h:column>

       <f:facet name="header">
               <f:verbatim>Left Hand Header</f:verbatim>
       </f:facet>

       <h:outputText value="#{ rowVar.radical_name}"/>
       </h:column>


       <h:column>

       <f:facet name="header">
               <f:verbatim>Right Hand Header</f:verbatim>
       </f:facet>

       <h:outputText value="#{rowVar.radical_value}"/>

       </h:column>

</h:dataTable>


(from backing bean)

private ArrayList templatesCollection = null;

public ArrayList getTemplatesCollection()
{
       System.out.println("Inside getTemplatesCollection");
       ArrayList tc = new ArrayList();
       HashMap hm1 = new HashMap();
       hm1.put (new String("radical_name"), new String("radical name1 "));

       UIInput image_url = new UIInput();
       image_url.setValue("textbox value display text");

       hm1.put(new String("radical_value"), image_url);


       HashMap hm2 = new HashMap();
       hm2.put(new String("radical_name"), new String("radical name2 "));

       UIInput image_url2 = new UIInput();
       image_url2.setValue("textbox2 value display text222");

       hm2.put(new String("radical_value"), image_url2);
       tc.add(hm1);
       tc.add(hm2);
       return tc;
}



Does anyone know how I could dynamically set the rows in the datatable with
form elements (not just text)?



Reply via email to