p:dataTable is not displaying result - jsf

JSF2.2 project deployed on the Wildfly 8.2.1, I am using the primefaces 6.2. When following code is diplayed on the browser it does not show any result even not the header.
diplayResult.xthml
<h:form id="form">
<div style="border: 1">
<h:messages globalOnly="true" errorClass="err" warnClass="warn"
infoClass="info"></h:messages>
<h:messages globalOnly="false" errorClass="err" warnClass="warn"
infoClass="info"></h:messages>
</div>
<h:panelGrid>
<h:outputLabel id="quantity1"> Line:</h:outputLabel>
<h:message for="quantity1"></h:message>
<h:inputText id="quantity"
value="#{dActivityRelatedController.quantity}"></h:inputText>
<h:message for="quantity" errorClass="err" warnClass="warn"
infoClass="info"></h:message>
<h:commandButton
action="#{dActivityRelatedController.getDndActivitySetupList()}"
value="list"></h:commandButton>
</h:panelGrid>
</h:form>
<h:form id="form2">
<p:dataTable var="activitySetup" value="#{dActivityRelatedController.activitySetupList}">
<f:facet name="header">
Activity Setup List
</f:facet>
<p:columnGroup type="header">
<p:row>
<p:column />
<p:column />
<p:column colspan="2" headerText="------Import Dem------" />
<p:column colspan="2" headerText="------Import Det------" />
<p:column colspan="2" headerText="------Export Dem------" />
<p:column colspan="2" headerText="------Export Det------" />
<p:column headerText="status" />
</p:row>
<p:row>
<p:column headerText="Last Year" />
<p:column headerText="This Year" />
<p:column headerText="From Activity Grp" />
<p:column headerText="To Activity Grp" />
<p:column headerText="From Activity Grp" />
<p:column headerText="To Activity Grp" />
<p:column headerText="From Activity Grp" />
<p:column headerText="To Activity Grp" />
<p:column headerText="From Activity Grp" />
<p:column headerText="To Activity Grp" />
<p:column headerText="" />
</p:row>
</p:columnGroup>
<p:column>
</p:column>
<p:column>
</p:column>
<p:column>
<h:outputText value="#{activitySetup.IMP_ACT_GROUP}" />
</p:column>
<p:column>
<h:outputText value="#{activitySetup.IMP_ACT_GROUP}" />
</p:column>
<p:column>
<h:outputText value="#{activitySetup.IMP_ACT_GROUP}" />
</p:column>
<p:column>
<h:outputText value="#{activitySetup.IMP_ACT_GROUP}" />
</p:column>
<p:column>
<h:outputText value="#{activitySetup.IMP_ACT_GROUP}" />
</p:column>
<p:column>
<h:outputText value="#{activitySetup.IMP_ACT_GROUP}" />
</p:column>
<p:column>
<h:outputText value="#{activitySetup.IMP_ACT_GROUP}" />
</p:column>
<p:column>
<h:outputText value="#{activitySetup.IMP_ACT_GROUP}" />
</p:column>
<p:column>
<h:outputText value="#{activitySetup.IMP_ACT_GROUP}" />
</p:column>
</p:dataTable>
</h:form>
JSF basic tags are working, as below code.
<h:form id="datatableform">
<h:dataTable
value="#{dActivityRelatedController.activitySetupList}"
var="activitySetup">
<h:column>
<f:facet name="header">From Activity Grp</f:facet>
#{activitySetup.IMP_ACT_GROUP}
</h:dataTable>
</h:form>
When I check the diplayed page using firebug, then the complete primefaces code is displayed on the browser that is written on the diplayResult.xthml. That should be converted into equivalent html tags

Related

Primefaces Datatable row selection inside dialog

I am sorry for my English. I have a JBoss Seam Project and using primefaces in user interface.We have a dialog and inside a datatable. When i select a row im getting following error
ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-localhost-127.0.0.1-8080-1) javax.resource.ResourceException: IJ000460: Error checking for a transaction
PersistenceException org.hibernate.exception.GenericJDBCException: Could not open connection
I thought maybe this error about hibernate but When i tired a lot of way about this problem i couldnt done it But when i moved dialog to new xhtml page it was done.I want to use dialog for my project instead of new page.Where is my mistake following code?
<h:form id="vehicleForm">
<p:commandButton id="selectClientButton" value="Musteri Sec" actionListener="#{clientFacade.clientSearchClear()}" />
</h:form>
<h:form id="selectClientForm">
<p:dialog widgetVar="selectClientDialog" resizable="true" draggable="true" modal="true" header="Arac Satis">
<h:panelGrid columns="4">
<h:outputText value="Adi" />
<h:outputText value="Soy Adı" />
<h:outputText value="TC/Vergi No." />
<h:outputText value="" />
<p:inputText value="#{clientFacade.client.name}" />
<p:inputText value="#{clientFacade.client.lastName}" />
<p:inputText value="#{clientFacade.client.taxNo}" />
<p:commandButton value="ARA" update=":selectClientForm:clientListDT" />
</h:panelGrid>
<p:dataTable id="clientListDT" rows="10" value="#{clientFacade.clientList}" var="client" >
<p:column style="width:3%" >
<p:commandLink id="test" actionListener="#{vehicleStockFacade.selectClient(client.clientId)}" ajax="false" >
<h:graphicImage value="#{icon.icon_select_mine_small}" rendered="#{client.isMyClient}" title="#{msg.choose}" width="15" height="15"/>
<h:graphicImage value="#{icon.icon_select_not_mine_small}" rendered="#{!client.isMyClient}" width="15" height="15" />
</p:commandLink>
</p:column>
<p:column>
<f:facet name="header" >
<h:outputText value="#{msg.client_name}" />
</f:facet>
<h:outputText value="#{client.name}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{msg.client_lastname}" />
</f:facet>
<h:outputText value="#{client.lastName}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{msg.tax_no}" />
</f:facet>
<h:outputText value="#{client.taxNo}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{msg.cell_phone}" />
</f:facet>
<h:outputText value="#{clientFacade.useMaskForPhone(client.mobilePhone)}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{msg.town}" />
</f:facet>
<h:outputText value="#{client.town}" />
</p:column>
<p:column>
<f:facet name="header" id="headerId" >
<h:outputText value="#{msg.address}" />
</f:facet>
<h:outputText value="#{client.addressLine1}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{msg.post_code}" />
</f:facet>
<h:outputText value="#{client.postCode}" />
</p:column>
</p:dataTable>
<f:facet name="footer">
<p:commandButton value="Secimi Kaldir" action="#{vehicleStockFacade.removeClientFromVehicleStock()}" style="float:right;margin-bottom:5px" ajax="false" />
</f:facet>
</p:dialog>
</h:form>

Global filter not working in p:dataTable

I have applied Global Filtering on a <p:dataTable> but that's not working at all. The getter is being called in the Bean but the <p:dataTable> is not being updated according to the search.
The code is:
<p:dialog id="searchStdentsDlg" header="Search Students" widgetVar="srchStdents" modal="true">
<h:form id="searchStdentsFrm">
<p:dataTable id="srchStdentsTble"
var="student"
value="#{viewStudentsBean.studentsList}"
widgetVar="srchStdentTbl"
emptyMessage="No students found with the given criteria"
filteredValue="#{viewStudentsBean.filteredStudents}">
<f:facet name="header">
<p:outputPanel>
<h:outputText value="Search Students:" />
<p:inputText id="globalFilterStdents" onkeyup="PF('srchStdentTbl').filter()" style="width:200px" placeholder="Enter keyword"/>
</p:outputPanel>
</f:facet>
<p:column id="stdentId" headerText="Id" filterBy="#{student.id}" filterStyle="display:none">
<h:outputText value="#{student.id}" />
</p:column>
<p:column id="stdentFirstName" headerText="Firstname" filterBy="#{student.firstName}" filterStyle="display:none">
<h:outputText value="#{student.firstName}" />
</p:column>
<p:column id="stdentLastname" headerText="Lastname" filterBy="#{student.lastName}" filterStyle="display:none">
<h:outputText value="#{student.lastName}" />
</p:column>
<p:column id="stdentFathername" headerText="Father name" filterBy="#{student.fatherName}" filterStyle="display:none">
<h:outputText value="#{student.fatherName}" />
</p:column>
<p:column id="stdentGender" headerText="Gender" filterBy="#{student.gender}" filterStyle="display:none">
<h:outputText value="#{student.gender}" />
</p:column>
<p:column id="stdentDOB" headerText="Date Of birth" filterBy="#{student.dob}" filterStyle="display:none">
<h:outputText value="#{student.dob}" />
</p:column>
<p:column id="stdentSkype" headerText="Skype/Email" filterBy="#{student.skypeOrEmailId}" filterStyle="display:none">
<h:outputText value="#{student.skypeOrEmailId}" />
</p:column>
<p:column id="stdentPhone" headerText="Phone No" filterBy="#{student.phoneNumber}" filterStyle="display:none">
<h:outputText value="#{student.phoneNumber}" />
</p:column>
<p:column id="stdentAddrs" headerText="Address" filterBy="#{student.address}" filterStyle="display:none">
<h:outputText value="#{student.address}" />
</p:column>
<p:column id="stdentCountry" headerText="Country" filterBy="#{student.country}" filterStyle="display:none">
<h:outputText value="#{student.country}" />
</p:column>
<p:column id="stdentJOD" headerText="Joining Date" filterBy="#{student.dateOfJoining}" filterStyle="display:none">
<h:outputText value="#{student.dateOfJoining}" />
</p:column>
<p:column id="stdentGenralRmrks" headerText="General Remarks" filterBy="#{student.generalRemarks}" filterStyle="display:none">
<h:outputText value="#{student.generalRemarks}" />
</p:column>
</p:dataTable>
</h:form>
</p:dialog>
I have another datatable in which Global Filtering is working absolutely fine.
That code is:
<p:dialog id="searchTchrsDlg" header="Search Teachers" widgetVar="srchTchrs" modal="true">
<h:form id="searchTchrsFrm">
<p:dataTable id="srchTechrsTble"
var="teacher"
value="#{viewTeachersBean.teachersList}"
widgetVar="srchTchrsTbl"
emptyMessage="No Teachers found with the given criteria"
filteredValue="#{viewTeachersBean.filteredTeachers}">
<f:facet name="header">
<p:outputPanel>
<h:outputText value="Search Teachers:" />
<p:inputText id="globalFilter" onkeyup="PF('srchTchrsTbl').filter()" style="width:200px" placeholder="Enter keyword"/>
</p:outputPanel>
</f:facet>
<p:column headerText="Id" filterBy="#{teacher.id}" filterStyle="display:none">
<h:outputText value="#{teacher.id}" />
</p:column>
<p:column headerText="Firstname" filterBy="#{teacher.firstName}" filterStyle="display:none">
<h:outputText value="#{teacher.firstName}" />
</p:column>
<p:column headerText="Lastname" filterBy="#{teacher.lastName}" filterStyle="display:none">
<h:outputText value="#{teacher.lastName}" />
</p:column>
<p:column headerText="Contact No" filterBy="#{teacher.contactNo}" filterStyle="display:none">
<h:outputText value="#{teacher.contactNo}" />
</p:column>
<p:column headerText="Address" filterBy="#{teacher.address}" filterStyle="display:none">
<h:outputText value="#{teacher.address}" />
</p:column>
<p:column headerText="Joining Date" filterBy="#{teacher.joiningDate}" filterStyle="display:none">
<h:outputText value="#{teacher.joiningDate}" />
</p:column>
<p:column headerText="Qualification" filterBy="#{teacher.qualification}" filterStyle="display:none">
<h:outputText value="#{teacher.qualification}" />
</p:column>
<p:column headerText="Subjects" filterBy="#{teacher.subjects}" filterStyle="display:none">
<h:outputText value="#{teacher.subjects}" />
</p:column>
<p:column headerText="Languages" filterBy="#{teacher.languagesProficiency}" filterStyle="display:none">
<h:outputText value="#{teacher.languagesProficiency}" />
</p:column>
<p:column headerText="Total Exp" filterBy="#{teacher.totalExperience}" filterStyle="display:none">
<h:outputText value="#{teacher.totalExperience}" />
</p:column>
<p:column headerText="Salary" filterBy="#{teacher.salary}" filterStyle="display:none">
<h:outputText value="#{teacher.salary}" />
</p:column>
<p:column headerText="Total Leaves" filterBy="#{teacher.totalLeavesLimit}" filterStyle="display:none">
<h:outputText value="#{teacher.totalLeavesLimit}" />
</p:column>
</p:dataTable>
</h:form>
</p:dialog>
I am using PrimeFaces 5.0 and JSF 2.2
PS: There are no exceptions on server side and no errors in browser console.
I would greatly appreciate any help. Thank you.

Primefaces Subtable inside another subtable

Can we use a simple subtable inside another subtable?
I tried to use like this, but html is not generated.
I can get this done by using ui:repeat or p:dataGrid, but the issue is that the generated data table must be able to be exported to Excel & PDF with p:dataExporter. That is not supported in primefaces if we use it with anything other than dataTable.
Please help.
<p:dataTable id="tbl" value="#{storeReportsTransfer.drows}" var="i" >
<f:facet name="header">
<h:outputLabel value="Department Issue Report "/>
<h:outputLabel value="#{storeReportsTransfer.fromDepartment.name}"/>
</f:facet>
<p:columnGroup type="header">
<p:row>
<p:column headerText="Department" />
<p:column headerText="Category" />
<p:column headerText="Item" />
<p:column headerText="Rate" />
<p:column headerText="Total" />
</p:row>
</p:columnGroup>
<p:subTable value="#{i.categoryBillRows}" var="cbr" >
<f:facet name="header">
<h:outputText value="#{i.department.name}" />
</f:facet>
<p:column >
</p:column>
<p:column>
<h:outputText value="#{cbr.category.name}" />
</p:column>
<p:column>
<p:subTable value="#{cbr.itemBillRows}" var="ibr" >
<p:column>
<h:outputText value="#{ibr.item.name}" />
</p:column>
<p:column>
<h:outputText value="#{ibr.bill.netTotal}" />
</p:column>
<p:column>
<h:outputText value="#{ibr.bill.grantTotal}" />
</p:column>
</p:subTable>
</p:column>
<p:columnGroup type="footer">
<p:row>
<p:column footerText="Totals: " style="text-align:right"/>
<p:column footerText="#{cbr.bill.netTotal}" />
</p:row>
</p:columnGroup>
</p:subTable>
</p:dataTable>

Issue in displaying p:messages for converterMessage

I am using PrimeFaces but I have problem with display <p:messages> for converterMessage.
When I use JSF tag <h:message>, it works correctly or even when I insert it into columns, but when I change to <p:message> it does not show. Can anybody helps me? My page is:
<h:form id="form2" prependId="false" style="direction:rtl;width: 600;top: 300px ;position: absolute" >
<p:messages for="count"/>
<p:outputLabel value="sum credit :#{shoppingBean.sumcredit}"/><br/>
<p:outputLabel value="shopping list :"/>
<p:dataTable id="dataTbl2" var="selectedProduct" value="#{shoppingBean.selectedProduct}" emptyMessage="no data"
paginatorAlwaysVisible="true" selection="#{shoppingBean.selection2}"
rowKey="#{selectedProduct.id}" disabledSelection="false" rows="5" paginator="true" pageLinks="5">
<p:column style="color: blue">
<f:facet name="header">
<h:outputText value="brand" />
</f:facet>
<h:outputText value="#{selectedProduct.tblShopProduct.brand}" />
</p:column>
<p:column style="color: blue">
<f:facet name="header">
<h:outputText value="price" />
</f:facet>
<h:outputText value="#{selectedProduct.tblShopProduct.price}" />
</p:column>
<p:column style="color: blue" >
<f:facet name="header">
<h:outputText value="date" />
</f:facet>
<h:outputText value="#{shoppingBean.tblShopOrder.created.toString().substring(0,11)}" />
<h:outputText value="#{shoppingBean.tblShopOrder.created.toString().substring(11,19)}" />
</p:column>
<p:column style="color: blue" >
<f:facet name="header">
<h:outputText value="number" />
</f:facet>
<h:outputText value="#{selectedProduct.number}" />
</p:column>
<p:column style="color: blue" >
<f:facet name="header">
<h:outputText value="amount" />
</f:facet>
<h:outputText value="#{selectedProduct.amount}" />
</p:column>
<p:column style="color: blue">
<f:facet name="header">
<h:outputText value="edit"/>**<h:inputText id="count" converterMessage="you allowed only for using number value="#{shoppingBean.count}"/>**
</f:facet>
<h:commandButton value="sum" rendered="#{selectedProduct.number==null}" action="#{shoppingBean.addProductCount(selectedProduct)}" />
<h:commandButton value="confirm" disabled="true" rendered="#{selectedProduct.number!=null}" />
</p:column>
<p:column style="color: blue" >
<f:facet name="header">
<h:outputText value="delete" />
</f:facet>
<h:commandButton value="delete" action="#{shoppingBean.deleteBuyed(selectedProduct)}" />
</p:column>
<f:facet name="footer">
<h:commandButton value="final shopping" action="#{shoppingBean.finalShop(selectedProduct)}" />
</f:facet>
</p:dataTable>
</h:form>
Tohid Makari.
<h:outputText value="edit"/>**<h:inputText id="count" converterMessage="you allowed only for using number value="#{shoppingBean.count}"/>**
This line could not work. Fix this first.
You do not update your messages tag.
Try something like this :
<p:messages for="count" autoUpdate="true" />

value not appearing in data table jsf

I'm trying to get value from 7 classes, for 7 columns
for interval one, interval two and so on for each student I have >
but the data table get's empty, but Java code is working fine.
I think the problem in html code tags
here is:
</h:form>
<h:form id="hesham1">
<p:scrollPanel style="width:100%;height:100%">
<p:dataTable var="car" value="#{tableBean.carsSmall}" id="hesham" encoding="windows-1256" dir="rtl" emptyMessage="لا يوجد بيانات او تأكد من البيانات المستعلم عنها">
<f:facet name="header">
الاستعلام عن صف 2-10
</f:facet>
<p:columnGroup type="header">
<p:row>
<p:column rowspan="2" headerText="اسم الطالب"/>
<p:column rowspan="2" headerText="التاريخ" />
<p:column colspan="3" headerText="الحصة الاولى" style="text-align: center;"/>
<p:column colspan="3" headerText="الحصة الثانية" style="text-align: center;"/>
<p:column colspan="3" headerText="الحصة الثالثة" style="text-align: center;"/>
<p:column colspan="3" headerText="الحصة الرابعة" style="text-align: center;"/>
<p:column colspan="3" headerText="الحصة الخامسة" style="text-align: center;"/>
<p:column colspan="3" headerText="الحصة السادسة" style="text-align: center;"/>
<p:column colspan="3" headerText="الحصة السابعة" style="text-align: center;"/>
</p:row>
<p:row>
<p:column headerText="المعلم" >
<h:outputText value="#{car.teachers}" />
</p:column>
<p:column headerText="الماده" >
</p:column>
<p:column headerText="الحالة" >
<h:outputText value="#{car.state}" />
</p:column>
<p:column headerText="المعلم" >
<h:outputText value="#{interval2.teachers2}" />
</p:column>
<p:column headerText="الماده" />
<p:column headerText="الحالة" >
<h:outputText value="#{interval2.state2}" />
</p:column>
<p:column headerText="المعلم" >
<h:outputText value="#{interval3.teachers3}" />
</p:column>
<p:column headerText="الماده" />
<p:column headerText="الحالة" >
<h:outputText value="#{interval3.state3}" />
</p:column>
<p:column headerText="المعلم" >
<h:outputText value="#{interval4.teachers4}" />
</p:column>
<p:column headerText="الماده" />
<p:column headerText="الحالة" >
<h:outputText value="#{interval4.state4}" />
</p:column>
<p:column headerText="المعلم" >
<h:outputText value="#{interval5.teachers5}" />
</p:column>
<p:column headerText="الماده" />
<p:column headerText="الحالة" >
<h:outputText value="#{interval5.state5}" />
</p:column>
<p:column headerText="المعلم" >
<h:outputText value="#{interval6.teachers6}" />
</p:column>
<p:column headerText="الماده" />
<p:column headerText="الحالة" >
<h:outputText value="#{interval6.state6}" />
</p:column>
<p:column headerText="المعلم" >
<h:outputText value="#{interval7.teachers7}" />
</p:column>
<p:column headerText="الماده" />
<p:column headerText="الحالة" >
<h:outputText value="#{interval7.state7}" />
</p:column>
</p:row>
</p:columnGroup>
<f:facet name="footer">
اجمالي عدد الاستعلامات #{fn:length(tableBean.carsSmall)}
</f:facet>
</p:dataTable>
</p:scrollPanel>
<br />
<h:commandButton value="طباعة التقرير" type="button"
icon="ui-icon-print">
<p:printer target="hesham" />
</h:commandButton>
</h:form>
Um.. you simply don't have a table body here. Everything you have is an enormous header, incorrectly referencing the iteration variable and a giant footer.
See this example for how it's done properly, the p:columnGroup only enclosing the header:
<p:dataTable id="salesTable" var="sale" value="#{tableBean.sales}">
<f:facet name="header">
Sales/Profits of Manufacturers
</f:facet>
<p:columnGroup type="header">
<p:row>
<p:column rowspan="2" headerText="Manufacturer" />
<p:column colspan="2" headerText="Sales" />
</p:row>
<p:row>
<p:column headerText="Sales Count" />
<p:column headerText="Profit" />
</p:row>
</p:columnGroup>
<p:column>
#{sale.manufacturer}
</p:column>
<p:column>
#{sale.lastYearProfit}%
</p:column>
</p:dataTable>

Resources