Précédent   Forum des professionnels en informatique > Logiciels > Solutions d'entreprise > Business Intelligence > Jasper
Jasper Forum d'entraide sur Jasper Reports. Avant de poster --> FAQ Jasper, Tutoriels Jasper
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 10/08/2011, 17h26   #1
Invité de passage
 
Inscription : mai 2009
Messages : 28
Détails du profil
Informations forums :
Inscription : mai 2009
Messages : 28
Points : 3
Points : 3
Par défaut jasperreport et JSF

Bonjour tout le monde,

en fait j'ai suivi le tuto de" Jaub " concernant l'utilisation de ireport dans une application j2EE jsf ,mais le probleme c'est que en executant le projet j ai une page d'erreur de type 404, j'utilise un rapport que j ai cree avec ireport 4.0.0 les jar que j'ai ajoute (itext-2.1.0.jar , jasperreports-4.0.0.jar,jasper-runtime-5.0.28.jar,jstl-1.1.2.jar,poi-2.0-final-20040126.jar,standard.jar)

ma class java
Code :
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
42
43
44
45
46
47
48
49
50
51
package com.jaub.view;
 
import java.io.*;
import java.sql.DriverManager;
import java.sql.SQLException;
 
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletResponse;
 
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
 
import com.mysql.jdbc.Connection;
import com.mysql.jdbc.Driver;
 
 
public class InitPageBean {
 
	public String viewReportPDF() throws SQLException, JRException, IOException {
		String reportId = "Person";
		Driver mDriver = new Driver();
		DriverManager.registerDriver(mDriver);
		String url = new String("jdbc:mysql://localhost/vdsbdd");
		Connection connection = (Connection) DriverManager.getConnection(
				url,
				"root",
				"root");
		File file = new File("C://Documents and Settings//KGQR5562//Bureau//Jesper//Test_de_jeudi2.jrxml");
		JasperPrint jasperPrint = JasperFillManager.fillReport(
				new FileInputStream(new File(file, reportId + ".jasper")),
				null, connection);
		byte[] bytes = JasperExportManager.exportReportToPdf(jasperPrint);
		FacesContext context = FacesContext.getCurrentInstance();
		HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse();
		/***********************************************************************
		 * Pour afficher une boîte de dialogue pour enregistrer le fichier sous
		 * le nom rapport.pdf
		 **********************************************************************/
		response.addHeader("Content-disposition",
				"attachment;filename=rapport.pdf");
		response.setContentLength(bytes.length);
		response.getOutputStream().write(bytes);
		response.setContentType("application/pdf");
		context.responseComplete();
		return null;
}
 
 
}
mon faces-config.xml
Code :
1
2
3
4
5
6
7
8
9
10
11
12
<?xml version="1.0" encoding="UTF-8"?>
 
<faces-config>
 
<managed-bean>
		<managed-bean-name>InitPageBean</managed-bean-name>
		<managed-bean-class>
			com.jaub.view.InitPageBean
		</managed-bean-class>
		<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-config>
mon web.xml
Code :
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>JSFProject</display-name>
  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
  </servlet-mapping>
  <context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>resources.application</param-value>
  </context-param>
  <context-param>
    <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
  </context-param>
	  <welcome-file-list>
    <welcome-file>init.jsp</welcome-file>
    <welcome-file>init.html</welcome-file>
  </welcome-file-list>
  <context-param>
    <description>
	This parameter tells MyFaces if javascript code should be allowed in
	the rendered HTML output.
	If javascript is allowed, command_link anchors will have javascript code
	that submits the corresponding form.
	If javascript is not allowed, the state saving info and nested parameters
	will be added as url parameters.
	Default is 'true'</description>
    <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
    <param-value>true</param-value>
  </context-param>
  <context-param>
    <description>
	If true, rendered HTML code will be formatted, so that it is 'human-readable'
	i.e. additional line separators and whitespace will be written, that do not
	influence the HTML code.
	Default is 'true'</description>
    <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
    <param-value>true</param-value>
  </context-param>
  <context-param>
    <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
    <param-value>false</param-value>
  </context-param>
  <context-param>
    <description>
	If true, a javascript function will be rendered that is able to restore the
	former vertical scroll on every request. Convenient feature if you have pages
	with long lists and you do not want the browser page to always jump to the top
	if you trigger a link or button action that stays on the same page.
	Default is 'false'
</description>
    <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
    <param-value>true</param-value>
  </context-param>
  <listener>
    <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
  </listener>
</web-app>
ma page index.xhtml
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?xml version="1.0" encoding="UTF-8"?>
<jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:jsp="http://java.sun.com/JSP/Page">
	<jsp:directive.page contentType="text/html;charset=UTF-8"
		pageEncoding="UTF-8" />
	<f:view>
		<html>
		<head>
		<title>Test iReport With JSF</title>
		</head>
		<body style="background-color: #fff4db">
		<h:form id="reportForm" target="report">
			<h:commandButton id="pdfButton" value="Visualiser PDF"
				styleClass="buttonStyle" action="#{InitPageBean.viewReportPDF}" style="color: #FF8000"/>
				</h:form>
		</body>
		</html>
	</f:view>
</jsp:root>
merci pour votre reponse
yassin_lhabe est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 11/08/2011, 15h30   #2
Invité de passage
 
Inscription : mai 2009
Messages : 28
Détails du profil
Informations forums :
Inscription : mai 2009
Messages : 28
Points : 3
Points : 3
Par défaut jasperreport et JSF

bonjour ,

je suis toujour bloque sur l'execution du rapport avec jsf et voila mon erreur :
Code :
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
javax.faces.el.EvaluationException: javax.el.PropertyNotFoundException: /index.xhtml @16,48 action="#{Generate.print}": Target Unreachable, identifier 'Generate' resolved to null
	at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:91)
	at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:98)
	at javax.faces.component.UICommand.broadcast(UICommand.java:311)
	at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:781)
	at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1246)
	at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
	at java.lang.Thread.run(Unknown Source)
Caused by: javax.el.PropertyNotFoundException: /index.xhtml @16,48 action="#{Generate.print}": Target Unreachable, identifier 'Generate' resolved to null
	at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:104)
	at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:84)
	... 20 more
yassin_lhabe est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 12/08/2011, 11h59   #3
Rédacteur/Modérateur
 
Avatar de JauB
 
Homme Faisel
Ingénieur COBOL/AS400
Inscription : octobre 2005
Messages : 1 713
Détails du profil
Informations personnelles :
Nom : Homme Faisel
Âge : 31
Localisation : Maroc

Informations professionnelles :
Activité : Ingénieur COBOL/AS400
Secteur : Finance

Informations forums :
Inscription : octobre 2005
Messages : 1 713
Points : 2 712
Points : 2 712
Envoyer un message via AIM à JauB Envoyer un message via MSN à JauB Envoyer un message via Yahoo à JauB
Bonjour,
Est ce que ta classe Generate a été déclarée au niveau de ton faces-config ?

Citation:
Envoyé par yassin_lhabe Voir le message
bonjour ,

je suis toujour bloque sur l'execution du rapport avec jsf et voila mon erreur :
Code :
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
javax.faces.el.EvaluationException: javax.el.PropertyNotFoundException: /index.xhtml @16,48 action="#{Generate.print}": Target Unreachable, identifier 'Generate' resolved to null
	at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:91)
	at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:98)
	at javax.faces.component.UICommand.broadcast(UICommand.java:311)
	at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:781)
	at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1246)
	at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
	at java.lang.Thread.run(Unknown Source)
Caused by: javax.el.PropertyNotFoundException: /index.xhtml @16,48 action="#{Generate.print}": Target Unreachable, identifier 'Generate' resolved to null
	at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:104)
	at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:84)
	... 20 more
__________________
*** Ingénieur COBOL/AS400 ***

-------------------------------------------------------------------

Mes articles, Mon Blog

Rubrique Jasper/iReport :
------- Forum Jasper --------
----- FAQ Jasper/iReport -----

JauB est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 12/08/2011, 15h32   #4
Invité de passage
 
Inscription : mai 2009
Messages : 28
Détails du profil
Informations forums :
Inscription : mai 2009
Messages : 28
Points : 3
Points : 3
Par défaut jasperreport et JSF

bonjour Faisel,
oui c'est bon j'avais des problémes de compatiblite des .jar ,mais il me réste un petit souci, je veux passe des parameters a mon rapport et je n'arrive pas ,
Merci
yassin_lhabe est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 15/08/2011, 11h20   #5
Rédacteur/Modérateur
 
Avatar de JauB
 
Homme Faisel
Ingénieur COBOL/AS400
Inscription : octobre 2005
Messages : 1 713
Détails du profil
Informations personnelles :
Nom : Homme Faisel
Âge : 31
Localisation : Maroc

Informations professionnelles :
Activité : Ingénieur COBOL/AS400
Secteur : Finance

Informations forums :
Inscription : octobre 2005
Messages : 1 713
Points : 2 712
Points : 2 712
Envoyer un message via AIM à JauB Envoyer un message via MSN à JauB Envoyer un message via Yahoo à JauB
Bonjour Yassine,
Pour le passage de paramètre tu peux voir sur la FAQ Jasper. Le lien te ramène directement sur ce que tu cherches
Bon courage
__________________
*** Ingénieur COBOL/AS400 ***

-------------------------------------------------------------------

Mes articles, Mon Blog

Rubrique Jasper/iReport :
------- Forum Jasper --------
----- FAQ Jasper/iReport -----

JauB est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 21/08/2011, 14h11   #6
Invité de passage
 
Femme hadjer
Développeur informatique
Inscription : juin 2011
Messages : 5
Détails du profil
Informations personnelles :
Nom : Femme hadjer
Localisation : Algérie

Informations professionnelles :
Activité : Développeur informatique
Secteur : High Tech - Éditeur de logiciels

Informations forums :
Inscription : juin 2011
Messages : 5
Points : 4
Points : 4
Envoyer un message via Yahoo à tulipe_info Envoyer un message via Skype™ à tulipe_info
salut Yassine


j'ai le même problème que vous , et je voulais savoir quelles sont les jar vous avez utilisés
merci d'avance
tulipe_info est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 22/08/2011, 15h46   #7
Invité de passage
 
Inscription : mai 2009
Messages : 28
Détails du profil
Informations forums :
Inscription : mai 2009
Messages : 28
Points : 3
Points : 3
bonjour tulipe,
en fait moi j'utilise la version 4.0.0 de ireport, et les .jar qui va avec sont:

commons-beanutils-1.7.0.jar
commons-collections-2.1.1.jar
commons-digester-1.7.jar
commons-logging-1.0.2.jar
itext-2.1.7.jar
iTextAsian.jar
itextpdf-5.1.1.jar
jasperreports-4.0.0.jar
jsf-api.jar
jsf-impl.jar
jstl-api-1.2.jar
jstl-impl-1.2.jar
bon courage.
yassin_lhabe est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/08/2011, 15h26   #8
Invité de passage
 
Femme hadjer
Développeur informatique
Inscription : juin 2011
Messages : 5
Détails du profil
Informations personnelles :
Nom : Femme hadjer
Localisation : Algérie

Informations professionnelles :
Activité : Développeur informatique
Secteur : High Tech - Éditeur de logiciels

Informations forums :
Inscription : juin 2011
Messages : 5
Points : 4
Points : 4
Envoyer un message via Yahoo à tulipe_info Envoyer un message via Skype™ à tulipe_info
Par défaut merci

merci
tulipe_info est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 08h59.


 
 
 
 
Partenaires

Hébergement Web