我们在 JSF2 中有一个带有 primefaces 6.1 + omnifaces 2.6.2 的应用程序,omnifaces 在多视图配置中非常适合以下网址:
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>
问题在于,多视图配置似乎与 primefaces 对话框框架存在一些问题。调用时closeDialog()
,抛出以下异常:
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
我们已经告诉将其添加到我们的 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>
尽管对话框框架现在可以工作并且无扩展工作,但多视图已停止工作,在任何多视图 URL 中返回 404
mysite/blogPost/my-very-first-post
无扩展仍然有效(mysite/blog)
问题是,我们如何使用primefaces 对话框架和多视图omnifaces 功能?