Hi,

I'm quite new to JSF and MyFaces. I have page that will do searching based on a keyword and populate table with paging capability. I'm using lates stable MyFaces and Tomahowk extension.

The problem is I can only seen 1 page. And when I try to move to another page. I have no data display on my dataTable.

Can someone give me some clue on my problem ??

My JSP page is shown below
-------------------------------------------------------------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 
4.0 Transitional//EN">
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri=" http://myfaces.apache.org/tomahawk" prefix="t"%>
<HTML>
<HEAD>
<TITLE><h:outputText value= "#{prop.appTitle}"/></TITLE>
<link rel="stylesheet" type="text/css" href="" color="red">"./css/basic.css" />
</HEAD>
<BODY>
<body>
<f:view>
<h:form>
 
<f:loadBundle basename="org.apache.myfaces.examples.resource.example_messages" var= "example_messages"/>
 
<h:commandButton id="validateButton" type="submit" value="search" actionListener="#{mydocs.doSearch}"/>
 
<h:panelGroup id="body">
<t:dataTable id="data"
styleClass="scrollerTable"
headerClass="standardTable_Header"
footerClass= "standardTable_Header"
rowClasses="standardTable_Row1,standardTable_Row2"
columnClasses="standardTable_Column,standardTable_ColumnCentered,standardTable_Column"
var="car"
value="#{mydocs.data}"
preserveDataModel="true"
rows="10"
>
<h:column>
<f:facet name="header">
</f:facet>
<h:outputText value="#{car.documentID}" />
</h:column>
 
<h:column>
<f:facet name= "header">
<h:outputText value="#{example_messages['label_cars']}" />
</f:facet>
<h:outputText value= "#{car.documentName}" />
</h:column>
 
<h:column>
<f:facet name="header">
<h:outputText value= "#{example_messages['label_color']}" />
</f:facet>
<h:outputText value="#{car.documentName}" />
</h:column>
 
</t:dataTable>
 
<h:panelGrid columns="1" styleClass="scrollerTable2" columnClasses="standardTable_ColumnCentered" >
<t:dataScroller id="scroll_1"
for="" color="red">"data"
fastStep="10"
pageCountVar="pageCount"
pageIndexVar="pageIndex"
styleClass= "scroller"
paginator="true"
paginatorMaxPages="9"
paginatorTableClass= "paginator"
paginatorActiveColumnStyle="font-weight:bold;"
immediate="true"
>
<f:facet name="first" >
<t:graphicImage url="" color="red">"images/arrow-first.gif" border= "1" />
</f:facet>
<f:facet name="last">
<t:graphicImage url="" color="red"> "images/arrow-last.gif" border="1" />
</f:facet>
<f:facet name="previous">
<t:graphicImage url= "" color="red">"images/arrow-previous.gif" border="1" />
</f:facet>
<f:facet name="next" >
<t:graphicImage url="" color="red">"images/arrow-next.gif" border="1" />
</f:facet>
<f:facet name= "fastforward">
<t:graphicImage url="" color="red">"images/arrow-ff.gif" border="1" />
</f:facet>
<f:facet name="fastrewind">
<t:graphicImage url="" color="red">"images/arrow-fr.gif" border="1" />
</f:facet>
</t:dataScroller>
<t:dataScroller id="scroll_2"
for="" color="red">"data"
rowsCountVar="rowsCount"
displayedRowsCountVar="displayedRowsCountVar"
firstRowIndexVar= "firstRowIndex"
lastRowIndexVar="lastRowIndex"
pageCountVar="pageCount"
immediate="true"
pageIndexVar="pageIndex"
>
<h:outputFormat value= "#{example_messages['dataScroller_pages']}" styleClass="standard" >
<f:param value="#{rowsCount}" />
<f:param value="#{displayedRowsCountVar}" />
<f:param value="#{firstRowIndex}" />
<f:param value="#{lastRowIndex}" />
<f:param value="#{pageIndex}" />
<f:param value= "#{pageCount}" />
</h:outputFormat>
</t:dataScroller>
</h:panelGrid>
 
</h:panelGroup>
<t:commandLink value= "test" immediate="true" />

</h:form>
</f:view>
 
</body>
</BODY>
</HTML>

-------------------------------------------------------------------------------------------------------------------


and my bean as follows..

-------------------------------------------------------------------------------------------------------------------


package org.phi.dms ;
 
import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
 
import javax.faces.event.ActionEvent;
 
public class DocumentsList implements Serializable {
/**
*
*/

private static final long serialVersionUID = 1;

private List objDocs = new LinkedList();

public void addDocument(Document e)
{
objDocs.add(e);
}

public List getData()
{
return objDocs;
}

public void doSearch(ActionEvent event)
{
objDocs.clear ();

addDocument(new Document("a","b"));
addDocument(new Document( "a","c"));
addDocument(new Document("a","d"));
addDocument( new Document("a","e"));
addDocument(new Document("a" ,"f"));
addDocument(new Document("a","g"));
addDocument( new Document("b","g"));
addDocument(new Document("c", "g"));
addDocument(new Document("d","g"));
addDocument(new Document("e","g"));
addDocument(new Document("f","g" ));
addDocument(new Document("g","g"));
addDocument(new Document( "h","g"));
}
}

-------------------------------------------------------------------------------------------------------------------

and

-------------------------------------------------------------------------------------------------------------------


package org.phi.dms;
 
import java.io.Serializable;
 
public class Document implements Serializable {
/**
*
*/

private static final long serialVersionUID = 1;

private String documentID;
private String documentName;

public Document(String myid, String myname)
{
documentID = myid;
documentName = myname;
}

public String getDocumentID() {
return documentID;
}
public void setDocumentID(String documentID) {
this.documentID = documentID;
}
public String getDocumentName() {
return documentName;
}
public void setDocumentName(String documentName) {
this.documentName = documentName;
}
}
-------------------------------------------------------------------------------------------------------------------


Regards,

Feris

Reply via email to