0

I have problem with primefaces datatable. My .xhtml file looks like this:

<!DOCTYPE html>
<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.org/ui">
<head>
    <title>List of students</title>
</head>

<h:body>
<h3>List students</h3>
<h:form>
    <p:dataTable var="item" value="#{studentManagedBean.students}" paginator="true" rows="10" styleClass="table table-hover"
                 paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
                 rowsPerPageTemplate="5,10,15" selectionMode="single" selection="#{studentManagedBean.item}" id="students" lazy="true">


        <p:column>
            <f:facet name="header">ID</f:facet>
            <h:outputText value="#{item.id}" />
        </p:column>
        <p:column>
            <f:facet name="header">Name</f:facet>
            <h:outputText value="#{item.name}" />
        </p:column>
        <p:column>
            <f:facet name="header">Age</f:facet>
            <h:outputText value="#{item.age}" />
        </p:column>
    </p:dataTable>
</h:form>

</h:body>
</html>

But I get this: my datatable looks

Instead of something like this: expecting datatable looks

Do you have any idea why?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
DrthKwas
  • 9
  • 2
  • please post web.xml and faces-config.xml. Also try without styleClass="table table-hover" – Mahendran Ayyarsamy Kandiar Dec 02 '15 at 23:25
  • you are getting that output cause of styleClass="table table-hover", either you can try without styleclass in datatable or need to update your style class also. – Piyush Gupta Dec 03 '15 at 04:21
  • styleClass is good, the solution is in [One or more resources has the target of 'head' but not 'head' component has been defined within the view ](http://stackoverflow.com/questions/18940644/one-or-more-resources-has-the-target-of-head-but-not-head-component-has-been) topic, thanks @BalusC – DrthKwas Dec 03 '15 at 16:22

0 Answers0