Paginator of doesn't show the data





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I'm new in this community, but I really need help!
I'm programming a application which gonna run in Desktop, with Java, and online, with Java Web, using Hibernate 4.3, without JPA, and Primefaces 8.2.
My issue is, I have a page with a dataTable, this dataTable contains a button on each register to open a dialog with more information of this register.
Inside this dialog i have another dataTable with another button inside each register.
Here I have two issues.



First, when user clicks on the button in the first dialog, the second dialog appears but, it just ignore the ActionListener.



Second, on the first dialog, when user clicks to go to other page of dataTable, or just increase the number of rows, the data disappear! If you close and reopen the dialog, it open in the page you clicked before and the data will be there.



I'll post the principal code of the problem, the github link and a video to make it easy to figure out the problem.



Bean.java



import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.enterprise.context.SessionScoped;
import javax.faces.bean.ManagedBean;
import javax.faces.event.ActionEvent;

import org.primefaces.model.LazyDataModel;

import com.sysnutriweb.dao.AlimentoXDietaDAO;
import com.sysnutriweb.dao.DietaDAO;
import com.sysnutriweb.dataModel.AlimentoDataModel;
import com.sysnutriweb.domain.Alimento;
import com.sysnutriweb.domain.AlimentoXDieta;
import com.sysnutriweb.domain.Dieta;

@ManagedBean(name = "MBDiet")
@SessionScoped
public class DietaBean implements Serializable {
private static final long serialVersionUID = 1L;
private List<Dieta> listDiets;
private Dieta diet = new Dieta();
private DietaDAO dDao;
private LazyDataModel<AlimentoXDieta> foods;
private Alimento food = new Alimento();

@PostConstruct
public void begin() {
dDao = new DietaDAO();
listDiets = dDao.loadAll();
}

public void getDietSelected(ActionEvent e) {
diet = (Dieta) e.getComponent().getAttributes().get("selectedDiet");
List<AlimentoXDieta> foods = new ArrayList<>();
List<AlimentoXDieta> axd = new AlimentoXDietaDAO().loadAll();
for (int i = 0; i < axd.size(); i++) {
if (axd.get(i).getDietId().getId() == diet.getId())
foods.add(axd.get(i));
}
this.foods = new AlimentoDataModel(foods);
}

public void getFoodSelected(ActionEvent e) {
food = (Alimento) e.getComponent().getAttributes().get("selectedFood");
}

// Getters and Setters


Index.xhtml



<f:metadata>
<f:param name="selectedDiet" value="#{MBDiet.diet}" />
</f:metadata>

<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Menu de dietas SysNutri</title>
</h:head>
<h:body>
<p:layout fullPage="true">
<p:layoutUnit position="north" size="100" resizable="false"
closable="false" collapsible="false">
<center>
<h:outputText value="Sistema de Nutrição SYSNUTRIWEB" />
</center>
</p:layoutUnit>
<p:layoutUnit position="center">
<h:form id="formTable">
<p:dataTable emptyMessage="Nenhum dado cadastrado!"
paginator="false" id="tbAllDiets" value="#{MBDiet.listDiets}"
var="diet">
<p:column headerText="Nome" id="nome">
<p:outputLabel value="#{diet.nomeDieta}" />
</p:column>
<p:column headerText="Descrição da dieta" id="descricao">
<p:outputLabel value="#{diet.descricaoDieta}" />
</p:column>
<p:column headerText="Ações" id="acoes" width="10%">
<center>
<p:commandButton immediate="false" icon="ui-icon-info"
id="btnInfo" update=":formInfoTable"
actionListener="#{MBDiet.getDietSelected}"
oncomplete="PF('dlgFoods').show()">
<f:attribute name="selectedDiet" value="#{diet}" />
</p:commandButton>
<p:tooltip id="toolTipBtnInfo" for="btnInfo"
value="Clique para ver os alimentos presentes nesta dieta"
position="top" />
</center>
</p:column>
</p:dataTable>
</h:form>
</p:layoutUnit>
</p:layout>
<!-- Dialogs -->
<!-- Diet info -->
<p:dialog header="Alimentos da dieta selecionada" widgetVar="dlgFoods"
closable="true" modal="true" showEffect="explode" id="dialogFoods"
resizable="false" draggable="false" appendTo="@(body)">
<h:form id="formInfoTable">
<center>
<p:outputLabel id="diet" value="Dieta #{MBDiet.diet.nomeDieta}"
style="font-weight: bold;" />
</center>
<p:dataTable emptyMessage="Nenhum dado cadastrado!" paginator="true"
id="tbFoodsDiet" value="#{MBDiet.foods}" var="food" rows="4"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="4,5,6,7,8,9,10" lazy="true">
<p:column headerText="Nome" id="nome" width="10px">
<p:outputLabel value="#{food.foodId.nome}" />
</p:column>
<p:column headerText="Hora para consumir" id="descricao" width="40%">
<p:outputLabel value="#{food.hora}" />
</p:column>
<p:column headerText="Ações" id="acoes" width="10%">
<center>
<p:commandButton immediate="false" icon="ui-icon-info"
id="btnInfo" update=":formInfo"
actionListener="#{MBDiet.getFoodSelected}"
oncomplete="PF('dlgFoodInfo').show()">
<f:attribute name="selectedFood" value="#{food}" />
</p:commandButton>
<p:tooltip id="toolTipBtnInfo" for="btnInfo"
value="Clique para ver os alimentos presentes nesta dieta"
position="top" />
</center>
</p:column>
</p:dataTable>
</h:form>
</p:dialog>
<!-- Second Dialog -->


Github: https://github.com/SakamotoLfe/SysNutriWebV0



Vdieo: Coming soon.










share|improve this question




















  • 4





    Hi, Comple of remarks. 1: PrimeFaces 8.2 does not exist, 2: JSF questions are very, very rarely hibernate (or even jpa) related. Ususally when you narrow things down with a Minimal, Complete, and Verifiable example it is either JSF or Hibernate/JPA related. 3: Read How to Ask about your title and also read the 'tagging' link in there about titles, and also read stackoverflow.com/tags/jsf/info. And read stackoverflow.com/questions/14429729/injecting-beans-in-jsf-2-0

    – Kukeltje
    Nov 26 '18 at 16:10











  • Thanks for the help! I saw the link you posted but, i'm not using CDI or any injected beans and i don't think i need to. I don't even know how to use. I need to finish this until 12/11/2018 so, i don't think i have time to learn about CDI and we don't have sure that's gonna solve the problem. About my title, it's better now? I really don't know, sorry for that and really thanks for your attention!

    – Alfredo Marin
    Nov 26 '18 at 16:45











  • Read the post again, it is not only directly abount injection. It islso about managed beans, cdi OR jsf ones. And you make an error thst is explained there... the imports 'same' error as in the first piece of code in the question but the other way around

    – Kukeltje
    Nov 26 '18 at 18:47













  • I get it!! It works!! The first issue is, wrong import. It has to be faces.bean Te second issue, i was casting to the wrong object and then we have a exception, already solved! Really Thanks!! I'll pay more attention on the imports. ... so now, how do I put this issue as a solved question?

    – Alfredo Marin
    Nov 26 '18 at 20:20











  • You don't need to. I'll mark it as a duplicate of the other one (and improve the title of the other one). But next time, please make a Minimal, Complete, and Verifiable example, also for yourself to narrow down things

    – Kukeltje
    Nov 26 '18 at 21:50


















0















I'm new in this community, but I really need help!
I'm programming a application which gonna run in Desktop, with Java, and online, with Java Web, using Hibernate 4.3, without JPA, and Primefaces 8.2.
My issue is, I have a page with a dataTable, this dataTable contains a button on each register to open a dialog with more information of this register.
Inside this dialog i have another dataTable with another button inside each register.
Here I have two issues.



First, when user clicks on the button in the first dialog, the second dialog appears but, it just ignore the ActionListener.



Second, on the first dialog, when user clicks to go to other page of dataTable, or just increase the number of rows, the data disappear! If you close and reopen the dialog, it open in the page you clicked before and the data will be there.



I'll post the principal code of the problem, the github link and a video to make it easy to figure out the problem.



Bean.java



import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.enterprise.context.SessionScoped;
import javax.faces.bean.ManagedBean;
import javax.faces.event.ActionEvent;

import org.primefaces.model.LazyDataModel;

import com.sysnutriweb.dao.AlimentoXDietaDAO;
import com.sysnutriweb.dao.DietaDAO;
import com.sysnutriweb.dataModel.AlimentoDataModel;
import com.sysnutriweb.domain.Alimento;
import com.sysnutriweb.domain.AlimentoXDieta;
import com.sysnutriweb.domain.Dieta;

@ManagedBean(name = "MBDiet")
@SessionScoped
public class DietaBean implements Serializable {
private static final long serialVersionUID = 1L;
private List<Dieta> listDiets;
private Dieta diet = new Dieta();
private DietaDAO dDao;
private LazyDataModel<AlimentoXDieta> foods;
private Alimento food = new Alimento();

@PostConstruct
public void begin() {
dDao = new DietaDAO();
listDiets = dDao.loadAll();
}

public void getDietSelected(ActionEvent e) {
diet = (Dieta) e.getComponent().getAttributes().get("selectedDiet");
List<AlimentoXDieta> foods = new ArrayList<>();
List<AlimentoXDieta> axd = new AlimentoXDietaDAO().loadAll();
for (int i = 0; i < axd.size(); i++) {
if (axd.get(i).getDietId().getId() == diet.getId())
foods.add(axd.get(i));
}
this.foods = new AlimentoDataModel(foods);
}

public void getFoodSelected(ActionEvent e) {
food = (Alimento) e.getComponent().getAttributes().get("selectedFood");
}

// Getters and Setters


Index.xhtml



<f:metadata>
<f:param name="selectedDiet" value="#{MBDiet.diet}" />
</f:metadata>

<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Menu de dietas SysNutri</title>
</h:head>
<h:body>
<p:layout fullPage="true">
<p:layoutUnit position="north" size="100" resizable="false"
closable="false" collapsible="false">
<center>
<h:outputText value="Sistema de Nutrição SYSNUTRIWEB" />
</center>
</p:layoutUnit>
<p:layoutUnit position="center">
<h:form id="formTable">
<p:dataTable emptyMessage="Nenhum dado cadastrado!"
paginator="false" id="tbAllDiets" value="#{MBDiet.listDiets}"
var="diet">
<p:column headerText="Nome" id="nome">
<p:outputLabel value="#{diet.nomeDieta}" />
</p:column>
<p:column headerText="Descrição da dieta" id="descricao">
<p:outputLabel value="#{diet.descricaoDieta}" />
</p:column>
<p:column headerText="Ações" id="acoes" width="10%">
<center>
<p:commandButton immediate="false" icon="ui-icon-info"
id="btnInfo" update=":formInfoTable"
actionListener="#{MBDiet.getDietSelected}"
oncomplete="PF('dlgFoods').show()">
<f:attribute name="selectedDiet" value="#{diet}" />
</p:commandButton>
<p:tooltip id="toolTipBtnInfo" for="btnInfo"
value="Clique para ver os alimentos presentes nesta dieta"
position="top" />
</center>
</p:column>
</p:dataTable>
</h:form>
</p:layoutUnit>
</p:layout>
<!-- Dialogs -->
<!-- Diet info -->
<p:dialog header="Alimentos da dieta selecionada" widgetVar="dlgFoods"
closable="true" modal="true" showEffect="explode" id="dialogFoods"
resizable="false" draggable="false" appendTo="@(body)">
<h:form id="formInfoTable">
<center>
<p:outputLabel id="diet" value="Dieta #{MBDiet.diet.nomeDieta}"
style="font-weight: bold;" />
</center>
<p:dataTable emptyMessage="Nenhum dado cadastrado!" paginator="true"
id="tbFoodsDiet" value="#{MBDiet.foods}" var="food" rows="4"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="4,5,6,7,8,9,10" lazy="true">
<p:column headerText="Nome" id="nome" width="10px">
<p:outputLabel value="#{food.foodId.nome}" />
</p:column>
<p:column headerText="Hora para consumir" id="descricao" width="40%">
<p:outputLabel value="#{food.hora}" />
</p:column>
<p:column headerText="Ações" id="acoes" width="10%">
<center>
<p:commandButton immediate="false" icon="ui-icon-info"
id="btnInfo" update=":formInfo"
actionListener="#{MBDiet.getFoodSelected}"
oncomplete="PF('dlgFoodInfo').show()">
<f:attribute name="selectedFood" value="#{food}" />
</p:commandButton>
<p:tooltip id="toolTipBtnInfo" for="btnInfo"
value="Clique para ver os alimentos presentes nesta dieta"
position="top" />
</center>
</p:column>
</p:dataTable>
</h:form>
</p:dialog>
<!-- Second Dialog -->


Github: https://github.com/SakamotoLfe/SysNutriWebV0



Vdieo: Coming soon.










share|improve this question




















  • 4





    Hi, Comple of remarks. 1: PrimeFaces 8.2 does not exist, 2: JSF questions are very, very rarely hibernate (or even jpa) related. Ususally when you narrow things down with a Minimal, Complete, and Verifiable example it is either JSF or Hibernate/JPA related. 3: Read How to Ask about your title and also read the 'tagging' link in there about titles, and also read stackoverflow.com/tags/jsf/info. And read stackoverflow.com/questions/14429729/injecting-beans-in-jsf-2-0

    – Kukeltje
    Nov 26 '18 at 16:10











  • Thanks for the help! I saw the link you posted but, i'm not using CDI or any injected beans and i don't think i need to. I don't even know how to use. I need to finish this until 12/11/2018 so, i don't think i have time to learn about CDI and we don't have sure that's gonna solve the problem. About my title, it's better now? I really don't know, sorry for that and really thanks for your attention!

    – Alfredo Marin
    Nov 26 '18 at 16:45











  • Read the post again, it is not only directly abount injection. It islso about managed beans, cdi OR jsf ones. And you make an error thst is explained there... the imports 'same' error as in the first piece of code in the question but the other way around

    – Kukeltje
    Nov 26 '18 at 18:47













  • I get it!! It works!! The first issue is, wrong import. It has to be faces.bean Te second issue, i was casting to the wrong object and then we have a exception, already solved! Really Thanks!! I'll pay more attention on the imports. ... so now, how do I put this issue as a solved question?

    – Alfredo Marin
    Nov 26 '18 at 20:20











  • You don't need to. I'll mark it as a duplicate of the other one (and improve the title of the other one). But next time, please make a Minimal, Complete, and Verifiable example, also for yourself to narrow down things

    – Kukeltje
    Nov 26 '18 at 21:50














0












0








0








I'm new in this community, but I really need help!
I'm programming a application which gonna run in Desktop, with Java, and online, with Java Web, using Hibernate 4.3, without JPA, and Primefaces 8.2.
My issue is, I have a page with a dataTable, this dataTable contains a button on each register to open a dialog with more information of this register.
Inside this dialog i have another dataTable with another button inside each register.
Here I have two issues.



First, when user clicks on the button in the first dialog, the second dialog appears but, it just ignore the ActionListener.



Second, on the first dialog, when user clicks to go to other page of dataTable, or just increase the number of rows, the data disappear! If you close and reopen the dialog, it open in the page you clicked before and the data will be there.



I'll post the principal code of the problem, the github link and a video to make it easy to figure out the problem.



Bean.java



import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.enterprise.context.SessionScoped;
import javax.faces.bean.ManagedBean;
import javax.faces.event.ActionEvent;

import org.primefaces.model.LazyDataModel;

import com.sysnutriweb.dao.AlimentoXDietaDAO;
import com.sysnutriweb.dao.DietaDAO;
import com.sysnutriweb.dataModel.AlimentoDataModel;
import com.sysnutriweb.domain.Alimento;
import com.sysnutriweb.domain.AlimentoXDieta;
import com.sysnutriweb.domain.Dieta;

@ManagedBean(name = "MBDiet")
@SessionScoped
public class DietaBean implements Serializable {
private static final long serialVersionUID = 1L;
private List<Dieta> listDiets;
private Dieta diet = new Dieta();
private DietaDAO dDao;
private LazyDataModel<AlimentoXDieta> foods;
private Alimento food = new Alimento();

@PostConstruct
public void begin() {
dDao = new DietaDAO();
listDiets = dDao.loadAll();
}

public void getDietSelected(ActionEvent e) {
diet = (Dieta) e.getComponent().getAttributes().get("selectedDiet");
List<AlimentoXDieta> foods = new ArrayList<>();
List<AlimentoXDieta> axd = new AlimentoXDietaDAO().loadAll();
for (int i = 0; i < axd.size(); i++) {
if (axd.get(i).getDietId().getId() == diet.getId())
foods.add(axd.get(i));
}
this.foods = new AlimentoDataModel(foods);
}

public void getFoodSelected(ActionEvent e) {
food = (Alimento) e.getComponent().getAttributes().get("selectedFood");
}

// Getters and Setters


Index.xhtml



<f:metadata>
<f:param name="selectedDiet" value="#{MBDiet.diet}" />
</f:metadata>

<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Menu de dietas SysNutri</title>
</h:head>
<h:body>
<p:layout fullPage="true">
<p:layoutUnit position="north" size="100" resizable="false"
closable="false" collapsible="false">
<center>
<h:outputText value="Sistema de Nutrição SYSNUTRIWEB" />
</center>
</p:layoutUnit>
<p:layoutUnit position="center">
<h:form id="formTable">
<p:dataTable emptyMessage="Nenhum dado cadastrado!"
paginator="false" id="tbAllDiets" value="#{MBDiet.listDiets}"
var="diet">
<p:column headerText="Nome" id="nome">
<p:outputLabel value="#{diet.nomeDieta}" />
</p:column>
<p:column headerText="Descrição da dieta" id="descricao">
<p:outputLabel value="#{diet.descricaoDieta}" />
</p:column>
<p:column headerText="Ações" id="acoes" width="10%">
<center>
<p:commandButton immediate="false" icon="ui-icon-info"
id="btnInfo" update=":formInfoTable"
actionListener="#{MBDiet.getDietSelected}"
oncomplete="PF('dlgFoods').show()">
<f:attribute name="selectedDiet" value="#{diet}" />
</p:commandButton>
<p:tooltip id="toolTipBtnInfo" for="btnInfo"
value="Clique para ver os alimentos presentes nesta dieta"
position="top" />
</center>
</p:column>
</p:dataTable>
</h:form>
</p:layoutUnit>
</p:layout>
<!-- Dialogs -->
<!-- Diet info -->
<p:dialog header="Alimentos da dieta selecionada" widgetVar="dlgFoods"
closable="true" modal="true" showEffect="explode" id="dialogFoods"
resizable="false" draggable="false" appendTo="@(body)">
<h:form id="formInfoTable">
<center>
<p:outputLabel id="diet" value="Dieta #{MBDiet.diet.nomeDieta}"
style="font-weight: bold;" />
</center>
<p:dataTable emptyMessage="Nenhum dado cadastrado!" paginator="true"
id="tbFoodsDiet" value="#{MBDiet.foods}" var="food" rows="4"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="4,5,6,7,8,9,10" lazy="true">
<p:column headerText="Nome" id="nome" width="10px">
<p:outputLabel value="#{food.foodId.nome}" />
</p:column>
<p:column headerText="Hora para consumir" id="descricao" width="40%">
<p:outputLabel value="#{food.hora}" />
</p:column>
<p:column headerText="Ações" id="acoes" width="10%">
<center>
<p:commandButton immediate="false" icon="ui-icon-info"
id="btnInfo" update=":formInfo"
actionListener="#{MBDiet.getFoodSelected}"
oncomplete="PF('dlgFoodInfo').show()">
<f:attribute name="selectedFood" value="#{food}" />
</p:commandButton>
<p:tooltip id="toolTipBtnInfo" for="btnInfo"
value="Clique para ver os alimentos presentes nesta dieta"
position="top" />
</center>
</p:column>
</p:dataTable>
</h:form>
</p:dialog>
<!-- Second Dialog -->


Github: https://github.com/SakamotoLfe/SysNutriWebV0



Vdieo: Coming soon.










share|improve this question
















I'm new in this community, but I really need help!
I'm programming a application which gonna run in Desktop, with Java, and online, with Java Web, using Hibernate 4.3, without JPA, and Primefaces 8.2.
My issue is, I have a page with a dataTable, this dataTable contains a button on each register to open a dialog with more information of this register.
Inside this dialog i have another dataTable with another button inside each register.
Here I have two issues.



First, when user clicks on the button in the first dialog, the second dialog appears but, it just ignore the ActionListener.



Second, on the first dialog, when user clicks to go to other page of dataTable, or just increase the number of rows, the data disappear! If you close and reopen the dialog, it open in the page you clicked before and the data will be there.



I'll post the principal code of the problem, the github link and a video to make it easy to figure out the problem.



Bean.java



import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.enterprise.context.SessionScoped;
import javax.faces.bean.ManagedBean;
import javax.faces.event.ActionEvent;

import org.primefaces.model.LazyDataModel;

import com.sysnutriweb.dao.AlimentoXDietaDAO;
import com.sysnutriweb.dao.DietaDAO;
import com.sysnutriweb.dataModel.AlimentoDataModel;
import com.sysnutriweb.domain.Alimento;
import com.sysnutriweb.domain.AlimentoXDieta;
import com.sysnutriweb.domain.Dieta;

@ManagedBean(name = "MBDiet")
@SessionScoped
public class DietaBean implements Serializable {
private static final long serialVersionUID = 1L;
private List<Dieta> listDiets;
private Dieta diet = new Dieta();
private DietaDAO dDao;
private LazyDataModel<AlimentoXDieta> foods;
private Alimento food = new Alimento();

@PostConstruct
public void begin() {
dDao = new DietaDAO();
listDiets = dDao.loadAll();
}

public void getDietSelected(ActionEvent e) {
diet = (Dieta) e.getComponent().getAttributes().get("selectedDiet");
List<AlimentoXDieta> foods = new ArrayList<>();
List<AlimentoXDieta> axd = new AlimentoXDietaDAO().loadAll();
for (int i = 0; i < axd.size(); i++) {
if (axd.get(i).getDietId().getId() == diet.getId())
foods.add(axd.get(i));
}
this.foods = new AlimentoDataModel(foods);
}

public void getFoodSelected(ActionEvent e) {
food = (Alimento) e.getComponent().getAttributes().get("selectedFood");
}

// Getters and Setters


Index.xhtml



<f:metadata>
<f:param name="selectedDiet" value="#{MBDiet.diet}" />
</f:metadata>

<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Menu de dietas SysNutri</title>
</h:head>
<h:body>
<p:layout fullPage="true">
<p:layoutUnit position="north" size="100" resizable="false"
closable="false" collapsible="false">
<center>
<h:outputText value="Sistema de Nutrição SYSNUTRIWEB" />
</center>
</p:layoutUnit>
<p:layoutUnit position="center">
<h:form id="formTable">
<p:dataTable emptyMessage="Nenhum dado cadastrado!"
paginator="false" id="tbAllDiets" value="#{MBDiet.listDiets}"
var="diet">
<p:column headerText="Nome" id="nome">
<p:outputLabel value="#{diet.nomeDieta}" />
</p:column>
<p:column headerText="Descrição da dieta" id="descricao">
<p:outputLabel value="#{diet.descricaoDieta}" />
</p:column>
<p:column headerText="Ações" id="acoes" width="10%">
<center>
<p:commandButton immediate="false" icon="ui-icon-info"
id="btnInfo" update=":formInfoTable"
actionListener="#{MBDiet.getDietSelected}"
oncomplete="PF('dlgFoods').show()">
<f:attribute name="selectedDiet" value="#{diet}" />
</p:commandButton>
<p:tooltip id="toolTipBtnInfo" for="btnInfo"
value="Clique para ver os alimentos presentes nesta dieta"
position="top" />
</center>
</p:column>
</p:dataTable>
</h:form>
</p:layoutUnit>
</p:layout>
<!-- Dialogs -->
<!-- Diet info -->
<p:dialog header="Alimentos da dieta selecionada" widgetVar="dlgFoods"
closable="true" modal="true" showEffect="explode" id="dialogFoods"
resizable="false" draggable="false" appendTo="@(body)">
<h:form id="formInfoTable">
<center>
<p:outputLabel id="diet" value="Dieta #{MBDiet.diet.nomeDieta}"
style="font-weight: bold;" />
</center>
<p:dataTable emptyMessage="Nenhum dado cadastrado!" paginator="true"
id="tbFoodsDiet" value="#{MBDiet.foods}" var="food" rows="4"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="4,5,6,7,8,9,10" lazy="true">
<p:column headerText="Nome" id="nome" width="10px">
<p:outputLabel value="#{food.foodId.nome}" />
</p:column>
<p:column headerText="Hora para consumir" id="descricao" width="40%">
<p:outputLabel value="#{food.hora}" />
</p:column>
<p:column headerText="Ações" id="acoes" width="10%">
<center>
<p:commandButton immediate="false" icon="ui-icon-info"
id="btnInfo" update=":formInfo"
actionListener="#{MBDiet.getFoodSelected}"
oncomplete="PF('dlgFoodInfo').show()">
<f:attribute name="selectedFood" value="#{food}" />
</p:commandButton>
<p:tooltip id="toolTipBtnInfo" for="btnInfo"
value="Clique para ver os alimentos presentes nesta dieta"
position="top" />
</center>
</p:column>
</p:dataTable>
</h:form>
</p:dialog>
<!-- Second Dialog -->


Github: https://github.com/SakamotoLfe/SysNutriWebV0



Vdieo: Coming soon.







java hibernate primefaces datatable dialog






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 26 '18 at 18:35









Vasil Lukach

2,94522132




2,94522132










asked Nov 26 '18 at 15:59









Alfredo MarinAlfredo Marin

11




11








  • 4





    Hi, Comple of remarks. 1: PrimeFaces 8.2 does not exist, 2: JSF questions are very, very rarely hibernate (or even jpa) related. Ususally when you narrow things down with a Minimal, Complete, and Verifiable example it is either JSF or Hibernate/JPA related. 3: Read How to Ask about your title and also read the 'tagging' link in there about titles, and also read stackoverflow.com/tags/jsf/info. And read stackoverflow.com/questions/14429729/injecting-beans-in-jsf-2-0

    – Kukeltje
    Nov 26 '18 at 16:10











  • Thanks for the help! I saw the link you posted but, i'm not using CDI or any injected beans and i don't think i need to. I don't even know how to use. I need to finish this until 12/11/2018 so, i don't think i have time to learn about CDI and we don't have sure that's gonna solve the problem. About my title, it's better now? I really don't know, sorry for that and really thanks for your attention!

    – Alfredo Marin
    Nov 26 '18 at 16:45











  • Read the post again, it is not only directly abount injection. It islso about managed beans, cdi OR jsf ones. And you make an error thst is explained there... the imports 'same' error as in the first piece of code in the question but the other way around

    – Kukeltje
    Nov 26 '18 at 18:47













  • I get it!! It works!! The first issue is, wrong import. It has to be faces.bean Te second issue, i was casting to the wrong object and then we have a exception, already solved! Really Thanks!! I'll pay more attention on the imports. ... so now, how do I put this issue as a solved question?

    – Alfredo Marin
    Nov 26 '18 at 20:20











  • You don't need to. I'll mark it as a duplicate of the other one (and improve the title of the other one). But next time, please make a Minimal, Complete, and Verifiable example, also for yourself to narrow down things

    – Kukeltje
    Nov 26 '18 at 21:50














  • 4





    Hi, Comple of remarks. 1: PrimeFaces 8.2 does not exist, 2: JSF questions are very, very rarely hibernate (or even jpa) related. Ususally when you narrow things down with a Minimal, Complete, and Verifiable example it is either JSF or Hibernate/JPA related. 3: Read How to Ask about your title and also read the 'tagging' link in there about titles, and also read stackoverflow.com/tags/jsf/info. And read stackoverflow.com/questions/14429729/injecting-beans-in-jsf-2-0

    – Kukeltje
    Nov 26 '18 at 16:10











  • Thanks for the help! I saw the link you posted but, i'm not using CDI or any injected beans and i don't think i need to. I don't even know how to use. I need to finish this until 12/11/2018 so, i don't think i have time to learn about CDI and we don't have sure that's gonna solve the problem. About my title, it's better now? I really don't know, sorry for that and really thanks for your attention!

    – Alfredo Marin
    Nov 26 '18 at 16:45











  • Read the post again, it is not only directly abount injection. It islso about managed beans, cdi OR jsf ones. And you make an error thst is explained there... the imports 'same' error as in the first piece of code in the question but the other way around

    – Kukeltje
    Nov 26 '18 at 18:47













  • I get it!! It works!! The first issue is, wrong import. It has to be faces.bean Te second issue, i was casting to the wrong object and then we have a exception, already solved! Really Thanks!! I'll pay more attention on the imports. ... so now, how do I put this issue as a solved question?

    – Alfredo Marin
    Nov 26 '18 at 20:20











  • You don't need to. I'll mark it as a duplicate of the other one (and improve the title of the other one). But next time, please make a Minimal, Complete, and Verifiable example, also for yourself to narrow down things

    – Kukeltje
    Nov 26 '18 at 21:50








4




4





Hi, Comple of remarks. 1: PrimeFaces 8.2 does not exist, 2: JSF questions are very, very rarely hibernate (or even jpa) related. Ususally when you narrow things down with a Minimal, Complete, and Verifiable example it is either JSF or Hibernate/JPA related. 3: Read How to Ask about your title and also read the 'tagging' link in there about titles, and also read stackoverflow.com/tags/jsf/info. And read stackoverflow.com/questions/14429729/injecting-beans-in-jsf-2-0

– Kukeltje
Nov 26 '18 at 16:10





Hi, Comple of remarks. 1: PrimeFaces 8.2 does not exist, 2: JSF questions are very, very rarely hibernate (or even jpa) related. Ususally when you narrow things down with a Minimal, Complete, and Verifiable example it is either JSF or Hibernate/JPA related. 3: Read How to Ask about your title and also read the 'tagging' link in there about titles, and also read stackoverflow.com/tags/jsf/info. And read stackoverflow.com/questions/14429729/injecting-beans-in-jsf-2-0

– Kukeltje
Nov 26 '18 at 16:10













Thanks for the help! I saw the link you posted but, i'm not using CDI or any injected beans and i don't think i need to. I don't even know how to use. I need to finish this until 12/11/2018 so, i don't think i have time to learn about CDI and we don't have sure that's gonna solve the problem. About my title, it's better now? I really don't know, sorry for that and really thanks for your attention!

– Alfredo Marin
Nov 26 '18 at 16:45





Thanks for the help! I saw the link you posted but, i'm not using CDI or any injected beans and i don't think i need to. I don't even know how to use. I need to finish this until 12/11/2018 so, i don't think i have time to learn about CDI and we don't have sure that's gonna solve the problem. About my title, it's better now? I really don't know, sorry for that and really thanks for your attention!

– Alfredo Marin
Nov 26 '18 at 16:45













Read the post again, it is not only directly abount injection. It islso about managed beans, cdi OR jsf ones. And you make an error thst is explained there... the imports 'same' error as in the first piece of code in the question but the other way around

– Kukeltje
Nov 26 '18 at 18:47







Read the post again, it is not only directly abount injection. It islso about managed beans, cdi OR jsf ones. And you make an error thst is explained there... the imports 'same' error as in the first piece of code in the question but the other way around

– Kukeltje
Nov 26 '18 at 18:47















I get it!! It works!! The first issue is, wrong import. It has to be faces.bean Te second issue, i was casting to the wrong object and then we have a exception, already solved! Really Thanks!! I'll pay more attention on the imports. ... so now, how do I put this issue as a solved question?

– Alfredo Marin
Nov 26 '18 at 20:20





I get it!! It works!! The first issue is, wrong import. It has to be faces.bean Te second issue, i was casting to the wrong object and then we have a exception, already solved! Really Thanks!! I'll pay more attention on the imports. ... so now, how do I put this issue as a solved question?

– Alfredo Marin
Nov 26 '18 at 20:20













You don't need to. I'll mark it as a duplicate of the other one (and improve the title of the other one). But next time, please make a Minimal, Complete, and Verifiable example, also for yourself to narrow down things

– Kukeltje
Nov 26 '18 at 21:50





You don't need to. I'll mark it as a duplicate of the other one (and improve the title of the other one). But next time, please make a Minimal, Complete, and Verifiable example, also for yourself to narrow down things

– Kukeltje
Nov 26 '18 at 21:50












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53484853%2fpaginator-of-pdatatable-doesnt-show-the-data%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53484853%2fpaginator-of-pdatatable-doesnt-show-the-data%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

To store a contact into the json file from server.js file using a class in NodeJS

Redirect URL with Chrome Remote Debugging Android Devices

Dieringhausen