Hi,
ich Versuche gerade mehr oder weniger meine erste JSF Seite zu schreiben.
Möchte eine Tabelle auf der Seite anzeigen.
Meine Seite sieht so aus:
und hier die Bean dazu:
Im Browser, wenn ich die Seite aufrufe bekomme ich jetzt den Fehler:
null source
könnte mir vll jemand weiterhelfen?
ich Versuche gerade mehr oder weniger meine erste JSF Seite zu schreiben.
Möchte eine Tabelle auf der Seite anzeigen.
Meine Seite sieht so aus:
HTML:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui">
<head>
<title>Book</title>
</head>
<body>
<p:dataTable id="booksTable" var="book" value="#{tableBean.books}"
paginator="true" rows="15" paginatorPosition="top"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="5,10,15">
<p:column>
<f:facet name="header">
<h:outputText value="isbn"/>
</f:facet>
<h:outputText value="#{book.isbn}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="author"/>
</f:facet>
<h:outputText value="#{book.author}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="title"/>
</f:facet>
<h:outputText value="#{book.title}"/>
</p:column>
</p:dataTable>
</h:form>
</body>
</html>
und hier die Bean dazu:
Java:
public class Table {
private static Logger log = LoggerFactory.getLogger(Table.class);
private List<Book> books = new ArrayList<Book>();
private ListDataModel booksModel;
private String beanName;
public Table() {
log.error("DataTableBean");
for (int i = 0; i < 10000 ; i++) {
books.add(new Book("isbn" + i, "author" + i, "title" + i));
}
booksModel = new ListDataModel(books);
}
public void addBooks(){
log.error("ADD");
for (int i = 0; i < 10000 ; i++) {
//books.add(new Book("isbn" + i, "author" + i, "title" + i));
books.remove(books.size()-1);
}
}
public List<Book> getBooks() {
//log.error(beanName);
return books;
}
public String getBeanName() {
return beanName;
}
public void setBeanName(String beanName) {
this.beanName = beanName;
}
public ListDataModel getBooksModel() {
return booksModel;
}
public void setBooksModel(ListDataModel booksModel) {
this.booksModel = booksModel;
}
}
Im Browser, wenn ich die Seite aufrufe bekomme ich jetzt den Fehler:
null source
Code:
java.lang.IllegalArgumentException: null source
at java.util.EventObject.<init>(EventObject.java:56)
at javax.faces.event.SystemEvent.<init>(SystemEvent.java:67)
at javax.faces.event.ComponentSystemEvent.<init>(ComponentSystemEvent.java:69)
at javax.faces.event.PostRestoreStateEvent.<init>(PostRestoreStateEvent.java:69)
at com.sun.faces.lifecycle.RestoreViewPhase.deliverPostRestoreStateEvent(RestoreViewPhase.java:256)
at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:245)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:107)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1805)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
könnte mir vll jemand weiterhelfen?