PrimeFaces对话框不会以编程方式显示

时间:2017-08-21 19:41:27

标签: jsf primefaces dialog

我一直在使用PrimeFaces库,对话框API在我的浏览器上无效。我使用IntelliJ IDE,这是我的样本:

的index.xhtml

<h:body>
<h:form var="mainForm" style="margin-bottom: 10px">
  <p:panelGrid columns="3" cellpadding="5">
  <h:outputLabel value="Please enter a name:"/>
  <p:inputText id="name" value="#{index.name}"/>
   <p:commandButton id="mButton" value="Submit" actionListener="#{index.buttonAction}" />
  </p:panelGrid>
</h:form>
</h:body>

Index.class

@ViewScoped
@ManagedBean(name="index")
public class Index implements Serializable {
    private String name;
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
        System.out.println(name);
    }
    public void buttonAction(){
        RequestContext requestContext = RequestContext.getCurrentInstance();
        List<String> paramValue = new ArrayList<String>();
        Map<String,List<String>> params = new HashMap<String,List<String>>();
        Map<String,Object> options =  new HashMap<String,Object>();
        options.put("height",200);
        options.put("width",200);
        options.put("contentWidth",200);
        options.put("contentHeight",200);
        paramValue.add(name);
        params.put("requestKey",paramValue);
        requestContext.openDialog("popup",options,params);
    }
}

在目录&#34; web&#34;有&#34; popup.xhtml&#34;和&#34; index.html&#34;。

我查了其他帖子,但没有一个对我有用。什么可能是错的?

0 个答案:

没有答案