1

We have an application in JSF2 with primefaces 6.1 + omnifaces 2.6.2, omnifaces is in multiviews configurations working really well with urls like:

mysite/blogPost/my-very-first-post

<context-param>
    <param-name>org.omnifaces.FACES_VIEWS_SCAN_PATHS</param-name>
    <param-value>/*.xhtml/*</param-value>
</context-param>

The problem is that it seems multiview configuration have some problems with primefaces dialog framework. When calling closeDialog(), below exception is thrown:

Caused by: java.lang.NullPointerException: Argument Error: Parameter key is null
    at com.sun.faces.util.Util.notNull(Util.java:487)
    at com.sun.faces.context.SessionMap.put(SessionMap.java:125)
    at com.sun.faces.context.SessionMap.put(SessionMap.java:61)
    at org.primefaces.context.DefaultRequestContext.closeDialog(DefaultRequestContext.java:205)
    at beansfacturacio.BeanFormesPagament.insereixTipus(BeanFormesPagament.java:61)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at javax.el.ELUtil.invokeMethod(ELUtil.java:332)
    at javax.el.BeanELResolver.invoke(BeanELResolver.java:537)
    at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:256)
    at com.sun.el.parser.AstValue.invoke(AstValue.java:283)
    at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304)
    at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
    at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
    at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
    ... 59 more

we have told to add this to our web.xml

<context-param>
   <param-name>org.omnifaces.FACES_VIEWS_DISPATCH_METHOD</param-name>
   <param-value>FORWARD</param-value>
</context-param>    

<context-param>
   <param-name>org.omnifaces.FACES_VIEWS_SCANNED_VIEWS_ALWAYS_EXTENSIONLESS</param-name>
   <param-value>false</param-value>
</context-param>

<context-param>
    <param-name>org.omnifaces.FACES_VIEWS_EXTENSION_ACTION</param-name>
    <param-value>PROCEED</param-value>
</context-param>

Althought dialog framework now works and extensionless works, multiviews have stopped to work returning 404 in any multiviews URL

mysite/blogPost/my-very-first-post

extensionless still works (mysite/blog)

The question is, how can we use primefaces dialog framework and multiview omnifaces feature?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
soekris
  • 11
  • 3
  • *"... some problems ..."* Which problems exactly? When I try a minimal page with a button which opens a DF dialog, then it works just fine for me. – BalusC May 28 '17 at 13:27
  • The problem is when bean tries to close dialog `RequestContext.getCurrentInstance().closeDialog(returnMess);` I've just added error log, sorry, I thought It was a known error – soekris May 28 '17 at 17:37
  • I'm doing a minimal maven project, let me some minutes please – soekris May 28 '17 at 18:42
  • Ah, only when you use `closeDialog()`. Yes, I reproduced this. – BalusC May 28 '17 at 20:38

1 Answers1

2

The root cause is that the pfdlgcid request parameter representing the dialog conversation identifier is missing in forms rendered in the dialog and hence the PrimeFaces DefaultRequestContext#closeDialog() couldn't terminate the dialog conversation.

I have fixed this for the upcoming OmniFaces 2.6.3. For now, you can work around this by removing all of those three additional context parameters and using only the below one:

<context-param>
    <!-- Workaround for disappearing PF DF ?pfdlgcid= parameter -->
    <!-- This can be removed when using OmniFaces 2.6.3 -->
    <param-name>org.omnifaces.FACES_VIEWS_VIEW_HANDLER_MODE</param-name>
    <param-value>BUILD_WITH_PARENT_QUERY_PARAMETERS</param-value>
</context-param>
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • I did a project in gitHub, but you were faster than me, https://github.com/simeoreig/omnifaces-testdialog Thanks a lot for your work for Java community !! – soekris May 28 '17 at 20:56
  • I have tested my gitHub project and it seems 2.6.3 does not fix the problem. It does not send a NPE but it does not work. – soekris Jun 20 '17 at 10:20