Reputation: 11
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?
Upvotes: 1
Views: 322
Reputation: 1108782
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>
Upvotes: 2