Answer the question
In order to leave comments, you need to log in
Problems with outputting data to a table (primefaces)?
Good evening, I ran into such a problem that I take data from the database and display it in a table using primefaces. This is what it looks like:
Connected strings using <p:column rowspan="4">
There is a model, dao, controller. From base I pull out only Column1and Column2
How it is possible to solve a problem? I searched on Google and didn't find a similar problem.
<?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:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:p="http://primefaces.org/ui"
xml:lang="en" lang="en">
<h:head>
<title></title>
</h:head>
<h:body>
<h:form id="form1">
<p:dataTable value="#{cmp.getAll()}" var="c" widgetVar="50" editable="true" >
<f:facet name="header">
Тест
</f:facet>
<p:ajax event="rowEdit" listener="#{cmp.update()}" update=":form1:messages" />
<p:ajax event="rowEditCancel" listener="#{cmp.delete()}" update=":form1:messages" />
<p:column>
<f:facet name="header">
<h:outputText value="Столбец 1" />
</f:facet>
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{c.name}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{c.name}" style="width:100%"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Столбец 2" />
</f:facet>
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{c.stoimost}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{c.stoimost}" style="width:100%"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column rowspan="4">
<f:facet name="header">
<h:outputText value="Столбец 3" />
</f:facet>
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{cmp.cmpModel.primechanie}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{cmp.cmpModel.primechanie}" style="width:100%"/>
</f:facet>
</p:cellEditor>
</p:column>
<!--< Редактирование >-->
<p:column headerText="" style="width:50px">
<p:rowEditor />
</p:column>
<!--< SummaryRow >-->
<p:columnGroup type="footer">
<p:row>
<p:column colspan="2" footerText="Total:"
style="text-align:right" />
<p:column footerText="#{cmp.total()}$" />
</p:row>
</p:columnGroup>
</p:dataTable>
</h:form>
</h:body>
</html>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question