I am trying to arbitrarily type in some values for a
datatable that is coded using JSF. I am new to the JSF
and please help me.

1. Do I set it correctly (see the code below)?
2. I have to hard code some data in the <h:dataTable 
..> that I create. How do I do it (i.e. how do I
modify the code shown below)?

My presentation JSP looks like:

<%@ taglib uri="http://java.sun.com/jsf/html";
prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core";
prefix="f" %>
<html>
        <head>
                <title>List of Personnel Candidates for
Departure</title>
        </head>
        <body>
                <f:view>
            <h:form id="selectedPersonnel">
                <h:dataTable
value="#{personnelList.personnel}" var="personnelBean"
binding="#{SelectedBean.table}">
                                <h:column>
                                        <f:facet name="header">
                                        <h:outputText value="Selected"/>
                                        </f:facet>
                                        <h:selectBooleanCheckbox id="selected"
binding="#{SelectedBean.selected}"/>
                                        </h:column>
                                <h:column>
                                        <f:facet name="header">
                                        <h:outputText value="SSN"/>
                                        </f:facet>    
                                        <h:outputText id="ssn"
value="#{personnelBean.ssn}"/>
                                    </h:column>
                                <h:column>
                                        <f:facet name="header">
                                        <h:outputText value="OPLAN"/>
                                        </f:facet>
                                        <h:outputText id="oplan"
value="#{personnelBean.oplan}"/>
                                    </h:column>
                                </h:dataTable>
                                <h:commandButton id="Depart" value="DEPART"
action="#{SelectedBean.updateDeparturePersonnel}"/>
                        </h:form>
                </f:view>
        </body> 
</html>  
 



The personnelList is the "managed bean". And the
personnel is an ArrayList.

I have a Java class that loads data into this
ArrayList "personnel". The Java class is called Table:

public class Table 
{
    ArrayList personnel;
    
    public ArrayList getPersonnel()
    {
        PersonnelBean pb = new PersonnelBean();
        pb.setOplan( " ");
        pb.setSsn( "  ");
        personnel.add( pb );
        return personnel;
    }
    public void setPersonnel( ArrayList personnel )
    {
        this.personnel = personnel;
    }
}



The PersonnelBean is a Java bean that get and set the
attributes:

public class PersonnelBean 
{
    String ssn;
    String oplan;
    
    public PersonnelBean()
    {
        //Empty Constructor
    }
 
    public String getSsn() 
    { 
        return ssn; 
    } 
 
    public void setSsn( String data ) 
    { 
        this.ssn = data; 
    } 
 
    
    public String getOplan() 
    { 
        return oplan; 
    } 
 
    public void setOplan( String data ) 
    { 
        this.oplan = data; 
    }
 }    



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to