RequestContext.getCurrentInstance().openDialog not working in @postConstruct init method

UI Components for JSF
Post Reply
jyalla2017
Posts: 1
Joined: 19 Jul 2017, 17:15

19 Jul 2017, 17:23

We used RequestContext.getCurrentInstance().openDialog in few screens in our application they are all working but when I use it in @postConstruct init method it is not working, I don't see any issue with code.

Code: Select all

if(!FacesContext.getCurrentInstance().isPostback()) {
        Map<String, Object> options = new HashMap<String, Object>();
        options.put("modal", true);
        options.put("draggable", true);
        options.put("resizable", true);
        options.put("contentHeight", "'100%'");
        options.put("contentWidth", "'100%'");
        options.put("height", "370");
        options.put("width", "700");
        Map<String, Object> params = new HashMap<String, Object>();
        FacesContext.getCurrentInstance().getExternalContext().getSessionMap()
                .put("value", params);
        RequestContext.getCurrentInstance().openDialog("dialogScreen.xhtml",
                options, null);
But I can open a dialog using showMessageInDialog using the below code snippet in @postConstruct.

Code: Select all

RequestContext.getCurrentInstance().showMessageInDialog(new FacesMessage("This is a message"));
I wanted to open xhtml using openDialog but it is not working in @postConstruct, don't know if there is anything specific config or code I am missing for this scenario. Any help will be greatly appreciated!!

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 31 guests