Primefaces Dialogue framework

2k Views Asked by At

I am creating a dialogue box which can then be used on multiple parent screens. (ie. customer search).

for the customer search dialogue box I have created following objects.

  1. SearchCustomerDlg.xhtml
  2. SearchCustomerMb.java
  3. DialogHanglerCustomerSearch.java
  4. DAO and Service layer objects which goes to Oracle database and searches the customers based on the criteria entered in the dialogue box.

I have parent xhtml page with its own managed bean and I using DialogHandlerCustomerSearch to get pass the output of search dialogue box.

However, I also want to pass the input parameter to the dialogue box so that the dialogue box can read the values and preset some of the search criteria when it opens.

Can anyone can help me please? I know that there is a params field when requesting the dialogue box.

    Map<String, List<String>> params = new HashMap<String, List<String>>();
    List<String> values = new ArrayList<String>();
    values.add("test");
    params.put("bookName", values);  
RequestContext.getCurrentInstance().openDialog("/ui/cor/SearchCustomerDlg", dialogConfig, params);

However, when I tried to read the param value in SearchCustomerMb but that shows value as null. So I am assuming that it is not passing it correctly or I am doing something wrong.

Also, how can I pass the parameter directly from PlDigitalSalesrpt.xhtml which then calls the dialogHandlerCustomerSearch ???

Please help... I looked at the below example but that didn't work.

http://www.javacodegeeks.com/2015/01/primefaces-opening-external-pages-in-dynamically-generated-dialog.html

1

There are 1 best solutions below

1
On BEST ANSWER

SearchCustomerDlg.xhtml could have:

<f:metadata>
    <f:viewParam name="bookName" value="#{searchCustomerMb.bookName}"/>
</f:metadata>

and then in SearchCustomerMb.java you need getBookName and setBookName