Hi all,
I'm new on this forum. I'm programming with Primefaces for a year and a half and used version 4.0 and 5.1. Until now I've ever found solutions to the issues I've faced with by reading documentation, published posts here, also in Stack Overflow and other sites.
My application code is based on JSF 5.1, mojarra 2.2.2 and Jetty 9.2.0 M1 (embedded).
Now I'm getting in trouble with Dialogs, I'm developping a graphical panel with multiple widgets in it and tried first to show detailed info with Dialog Component. But I'm getting some problems because my code includes my own composite components inside the dialogs and not all the components work properly.
So now I'm trying with Dialog Framework in order to open my own xhtml page inside it and found the next exception error which I've not found a solution for:
sep 28, 2015 5:27:52 PM com.sun.faces.context.AjaxExceptionHandlerImpl handlePartialResponseError
GRAVE: java.lang.NullPointerException
at org.primefaces.application.DialogNavigationHandler.handleNavigation(DialogNavigationHandler.java:47)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:132)
at org.primefaces.application.DialogActionListener.processAction(DialogActionListener.java:45)
at javax.faces.component.UICommand.broadcast(UICommand.java:315)
at com.sun.faces.facelets.component.UIRepeat.broadcast(UIRepeat.java:929)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:751)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:566)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:543)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1111)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:498)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1045)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:199)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:543)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:98)
at org.eclipse.jetty.server.Server.handle(Server.java:462)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:284)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:244)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:534)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:607)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:536)
at java.lang.Thread.run(Thread.java:745)
In order to use Dialog Framework I've included in the faces-config.xhtml the next lines:
<application>
<action-listener>
org.primefaces.application.DialogActionListener
</action-listener>
<navigation-handler>
org.primefaces.application.DialogNavigationHandler
</navigation-handler>
<view-handler>
org.primefaces.application.DialogViewHandler
</view-handler>
</application>
After getting the above exception I've decided to make a simply test and I'm calling the Dialog with the next test code with the same NullPointerException result:
<p:remoteCommand id="rc0" name="#{widget.value.getName()}_dblclick"
actionListener="#{paneldf.openBeanDialog()}">
</p:remoteCommand>
public void openBeanDialog() {
getBeanFromMap();
Map<String, Object> opt = new LinkedHashMap<String, Object>();
opt.put("resizable", false);
RequestContext.getCurrentInstance().openDialog("dialogBean.xhtml", opt, null);
}
both the original and this test dialogBean.xhtml are ui:composition and the browser gets no error loading them:
<ui:composition template="/WEB-INF/plantilla.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:p="http://primefaces.org/ui"
xmlns:dc="http://java.sun.com/jsf/composite/components/dc">
<ui:define name="head">
<h:head>
<title>Vista Detallada</title>
</h:head>
</ui:define>
<ui:define name="plantilla-cabecera" />
<ui:define name="plantilla-cuerpo">
<noscript>
<h:outputText
value="Javascript es necesario para visualizar correctamente esta página." />
</noscript>
<h:outputText style="font-weight:100">TEXT...</h:outputText>
</ui:define>
<ui:define name="plantilla-pie" />
</ui:composition>
What I'm doing wrong? There are incompatibilities with jetty? There is a bug here?
Thank You and Best Regards
Juan
Dialog Framework in Primefaces 5.1 throws NullPointerExcepti
Hi again,
After several weeks with no time to continue developping my app and without answers to my questions, I've tried to update to Primefaces 5.3 with the same result: I get the NullPointerException again.
I've downloaded the sources and I see the exception is in the next line of code:
@Override
public void handleNavigation(FacesContext context, String fromAction, String outcome) {
RequestContext requestContext = RequestContext.getCurrentInstance();
Map<Object,Object> attrs = requestContext.getAttributes();
String dialogOutcome = (String) attrs.get(Constants.DIALOG_FRAMEWORK.OUTCOME);
if(dialogOutcome != null) {
NavigationCase navCase = getNavigationCase(context, fromAction, dialogOutcome);
String toViewId = navCase.getToViewId(context);
Map<String,Object> options = (Map<String,Object>) attrs.get(Constants.DIALOG_FRAMEWORK.OPTIONS);
Map<String,List<String>> params = (Map<String,List<String>>) attrs.get(Constants.DIALOG_FRAMEWORK.PARAMS);
So the problem seems a bug not resolved since 5.1 version (maybe a previous version) and seems to be related to FacesContext context parameter of the handleNavigation method.
Now I'm asking: Does anybody have got a working Dialog Framework with community version of Primefaces?
Kind regards
Juan
After several weeks with no time to continue developping my app and without answers to my questions, I've tried to update to Primefaces 5.3 with the same result: I get the NullPointerException again.
I've downloaded the sources and I see the exception is in the next line of code:
@Override
public void handleNavigation(FacesContext context, String fromAction, String outcome) {
RequestContext requestContext = RequestContext.getCurrentInstance();
Map<Object,Object> attrs = requestContext.getAttributes();
String dialogOutcome = (String) attrs.get(Constants.DIALOG_FRAMEWORK.OUTCOME);
if(dialogOutcome != null) {
NavigationCase navCase = getNavigationCase(context, fromAction, dialogOutcome);
String toViewId = navCase.getToViewId(context);
Map<String,Object> options = (Map<String,Object>) attrs.get(Constants.DIALOG_FRAMEWORK.OPTIONS);
Map<String,List<String>> params = (Map<String,List<String>>) attrs.get(Constants.DIALOG_FRAMEWORK.PARAMS);
So the problem seems a bug not resolved since 5.1 version (maybe a previous version) and seems to be related to FacesContext context parameter of the handleNavigation method.
Now I'm asking: Does anybody have got a working Dialog Framework with community version of Primefaces?
Kind regards
Juan
For anyone struggling with this, I just debugged the Mojarra 2.1.20_10 implementation to find why it breaks existing code with the above NPE.
This line was working fine in a project a couple of years old (and I'm not sure what Mojarra version it ran successfully on):
It gets to a point where it tries a lot of different options for navigation, depending on what is in the navigationMap. My navigationMap was empty, even though the method still knew where the request originated and where it was trying to go (apologies I can't recall what the class within the Mojarra jar was). Anyway, it looks to see if the requested resource begins with a slash character, and if it doesn't, it finds the first one and for some reason prepends the substring to that point onto the string, so the above request for:
somefolder/subfolder/mypage
turns into
somefolder/somefolder/subfolder/mypage
It then obviously appends the .xhtml onto it, but the damage has been done and it clearly can't find that resource. So I tried putting a starting slash, e.g.
and it finds it ok. I hope this helps someone.
This line was working fine in a project a couple of years old (and I'm not sure what Mojarra version it ran successfully on):
Code: Select all
RequestContext.getCurrentInstance().openDialog("somefolder/subfolder/mypage", options, null);
somefolder/subfolder/mypage
turns into
somefolder/somefolder/subfolder/mypage
It then obviously appends the .xhtml onto it, but the damage has been done and it clearly can't find that resource. So I tried putting a starting slash, e.g.
Code: Select all
RequestContext.getCurrentInstance().openDialog("/somefolder/subfolder/mypage", options, null);
-
- Information
-
Who is online
Users browsing this forum: No registered users and 54 guests