Dialog in PrimeFaces 4.0 not working

I am trying to implement a "basic dialogue structure", but not use it during implementation ... it does not show any errors in the console ...

xhtml page ---> program.xhtml

<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:p="http://primefaces.org/ui" template="/pages/BaseTemplate.xhtml"> <ui:define name="body"> <h:form id="form"> <p:commandButton value="ABCD" actionListener="#{pc_Program.goToCurrentStage}"/> </h:form> </ui:define> </ui:composition> 

managed bean -> Program.java

  @ManagedBean(name = "pc_Program") @SessionScoped public class Program{ public void goToCurrentStage(){ Map<String,Object> options = new HashMap<String, Object>(); options.put("modal", true); options.put("draggable", false); options.put("resizable", false); options.put("contentHeight", 320); RequestContext.getCurrentInstance().openDialog("intimationDepositHome", options, null); } } 

I need to open the intimationDeposit.xhtml dialog when I click on commandbutton in program.xhtml

  <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:p="http://primefaces.org/ui" template="/pages/BaseTemplate.xhtml"> <ui:define name="body"> <h:form id="form"> <p:dataTable id="serDetails" var="bean" value="#{pc_intimationDeposit.pendingReps}" > <p:column headerText="Unique Id" style="width: 15px"> <h:outputText value="#{bean.uniqueId}" styleClass="box text"/> </p:column> </p:dataTable> </ui:define> </ui:composition> 

managed bean ---> IntimationDeposit.java

  @ManagedBean(name = "pc_intimationDeposit") @SessionScoped public class IntimationDeposit{ public List<PendingRep> pendingReps = new ArrayList<PendingRep>(); //setter/getters and some logic to get PendingRep List } 

in my faces-config.xml I added ...

  <application> <action-listener>org.primefaces.application.DialogActionListener</action-listener> <navigation-handler>org.primefaces.application.DialogNavigationHandler</navigation-handler> <view-handler>org.primefaces.application.DialogViewHandler</view-handler> </application> 

case for navigation


  <navigation-rule> <from-view-id>*</from-view-id> <navigation-case> <from-outcome>intimationDepositHome</from-outcome> <to-view-id>/pages/intimationDeposit.xhtml</to-view-id> </navigation-case> </navigation-rule> 

but the dialog did not open ... and did not get any error message ...

+4
source share
2 answers

maybe you need to use annotation. I have the same problem and I solve it with the @postconstruct annotation in the init method and after // setter / getters and some logic to get the PendingRep list that you need.

0
source

I also have the same development as your code. This is a job for me. But, I think there is no critical problem in your code.

Only one error in the code.

 there is no end tag `</h:form>` at `intimationDeposit.xhtml` page. 

if so, the dialog box will not open. But you will get an error, for example:

  element type "h:form" must be terminated by the matching end-tag "</h:form>" 
0
source

Source: https://habr.com/ru/post/1489623/


All Articles