i think your are looking for this?
DAO
----
qury="select accountno,name,address,state from tablename";
ArrayList al = new ArrayList();
resultset rs = stmt.executeQuery(qury);
while(rs.next())
{
ManagedBean bean = new ManagedBean();
bean.setAccountNo(rs.getString(1));
bean.setName(rs.getString(2));
bean.setAddress(rs.getString(3));
bean.setState(rs.getString(4));
al.add(bean);
}
jsf
****
iterate this arraylist in jsf
<h:dataTable value="#{managedBean.list}" var="loc">
<h:column>
<f:facet name="header" >
<h:commandLink action="#{managedBean.someAction}">
<h:outputText value="Account No"/>
<f:param name="AccountName" value="Account No"/>
</h:commandLink>
</f:facet>
<h:outputText value="#{loc.AccountNo}"/>
</h:column>
<h:column>
<f:facet name="header" >
<h:outputText value="Name"/>
</f:facet>
<h:outputText value="#{loc.Name}"/>
</h:column>
<h:column>
<f:facet name="header" >
<h:outputText value="Address"/>
</f:facet>
<h:outputText value="#{loc.Address}"/>
</h:column>
<h:column>
<f:facet name="header" >
<h:outputText value="State"/>
</f:facet>
<h:outputText value="#{loc.State}"/>
</h:column>
</h:dataTable>
Backing bean code:
*******************
public String someAction() {
ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
HttpServletRequest request = (HttpServletRequest) context.getRequest();
String parameterValue = request.getParameter("AccountName");
// Code here
return null
}