Bonjour,
je suis parti de l'exemple : https://www.primefaces.org/showcase/...download.xhtml
et l'ai integré dans mon environnement :
bean :
le fichier XML est bien créé
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 ... ... private StreamedContent fileXML; ... ... ... ... ... private void CreationFichier() { String pFichier = "C:\\Data\\eclipse-workspace\\calcultoric\\WebContent\\img\\xml\\" + getIdFichier() + ".xml"; EcrireXML f = new EcrireXML(pFichier); f.run(this); InputStream stream = FacesContext.getCurrentInstance().getExternalContext().getResourceAsStream(pFichier); fileXML = new DefaultStreamedContent(stream, "application/txt", pFichier); } ... ... ... ... public StreamedContent getFileXML() { MyLog4j.logger.debug("getFileXML"); return fileXML; } }
et dans ma page :
et voila l'erreur levée dans la console, apparement dans le getFileXML:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 <p:dialog modal="true" widgetVar="statusDialog" header="Status" draggable="false" closable="false" resizable="false"> <h:outputText for="wait" value="merci de patienter..."/> </p:dialog> ... ... <p:commandButton value="Imprimer" ajax="false" onclick="PrimeFaces.monitorDownload(start, stop);" > <p:fileDownload value="#{calculForm.fileXML}" /> </p:commandButton> ... ... ... <script type="text/javascript"> function start() { PF('statusDialog').show(); } function stop() { PF('statusDialog').hide(); } </script>
merci pour votre aide
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41 mai 30, 2018 3:31:17 PM com.sun.faces.context.ExceptionHandlerImpl log 1100: JSF1073 : javax.faces.FacesException intercepté durant le traitement de INVOKE_APPLICATION 5 : UIComponent-ClientId=, Message=null mai 30, 2018 3:31:17 PM com.sun.faces.context.ExceptionHandlerImpl log 1100: No associated message javax.faces.FacesException at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:89) 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.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:613) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.NullPointerException at org.primefaces.component.filedownload.FileDownloadActionListener.processAction(FileDownloadActionListener.java:90) at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88) at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:813) at javax.faces.component.UICommand.broadcast(UICommand.java:300) at javax.faces.component.UIData.broadcast(UIData.java:1108) 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) ... 25 more
Partager