Yet another post on primefaces dialog framework.
I've been watching all of these previous posts:
Primefaces Dialog Framework - Not Working
primefaces dialog using dialog framework not popping up
Primefaces dialog framework not working while using ajax listener
I've been trying all of these but still the dialog just doesn't show up.\
I'm using primefaces 5.1
.
Let me add some details.
Page with a button that should call the dialog:
<!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:p="http://primefaces.org/ui" >
<h:form>
<p:commandButton
value="prova popup"
actionListener="#{codTribEr.chooseCodiceErario('/popup/codice-erario.xhtml')}">
</p:commandButton>
</h:form>
</html>
Java code:
package it.iwb.ubiss.poc.popup;
import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import org.primefaces.context.RequestContext;
@ManagedBean(name="codTribEr")
@ViewScoped
public class CodiceTributoErario implements Serializable{
private static final long serialVersionUID = 1L;
public void chooseCodiceErario(String s) {
RequestContext.getCurrentInstance().openDialog(s);
}
}
You use incorrect structure of JSF.
f:attribute
The example code is shown below.
xhtml
managedbean
codice-erario.xhtml