salut ! commuté, quelqu'un peut m'aider
j'ai une classe opération,
et versement ou retrait
qui hérite de opération
et versement même chose avec retrait
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 @Entity @Data @NoArgsConstructor @AllArgsConstructor public class Operation implements Serializable{ @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Long numeroOperation; private LocalDate dateOperation; private double montant; private String designation; private String dtypeOp; @ManyToOne @JoinColumn(name="codeCaisse") private Caisse caisse; @ManyToOne @JoinColumn(name="username") private Utilisateur user; @ManyToOne @JoinColumn(name="iddepot") private Depositeur depo; }
quand j'effectue le mapping , j'obtient ça,
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 @Entity public class Versement extends Operation{ public Versement() { super(); // TODO Auto-generated constructor stub } public Versement(Long numeroOperation, LocalDate dateOperation, double montant, String designation, String dtypeOp, Caisse caisse, Utilisateur user, Depositeur depositeur) { super(numeroOperation, dateOperation, montant, designation, dtypeOp, caisse, user, depositeur); // TODO Auto-generated constructor stub }
et quand je fait l'enregistrement d'une opération tout ce passe bien et la lecture
voici comment je fait pour lire les données avec thymeleaf sachant que ma classe opération est hérite, le résultat est celui attendu
Code JSP : 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 <table class="table table-striped"> <thead> <tr><th>Numéro</th><th>Type</th><th>Date</th> <th>Motif</th><th>Montant</th></tr> </thead> <tbody> <tr th:each="e:${operation}"> <td th:text="${e.numeroOperation}"></td> <td th:text="${e.class.simpleName}"></td> <td th:text="${e.dateOperation}"></td> <!-- <td th:text="${e.depositeur.idClient}"></td> --> <td th:text="${e.designation}"></td> <td th:text="${e.montant}"></td> <!-- <td> <a th:href="@{deleteOperation(numeroOperation=${e.numeroOperation})}" class="btn btn-info"><i class="fas fa-eye"></i>Supprimer</a> </td> --> </tr>
mais lorsque j'essaie d'imprimer en html ou pdf avec irepport j'obtiens une erreur
voila mon service
voici mon fichier jrxm
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57 @Autowired private ReportService service; @GetMapping("/reportOperation/{format}") private String exportReportOperation(@PathVariable String format) throws FileNotFoundException, JRException { return service.exportReportOperation(format); } public String exportReportOperation(String format) throws FileNotFoundException, JRException { List<Operation> ls = cDa.listSimple(); String path = "C:\\Users\\kING\\Documents\\Reports"; //C:\Users\kING\Documents File file = ResourceUtils.getFile("classpath:listOp.jrxml"); JasperReport jasper = JasperCompileManager.compileReport(file.getAbsolutePath()); JRBeanCollectionDataSource ds = new JRBeanCollectionDataSource(ls); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("creadBy", "Ma caisse"); JasperPrint jasperPrint = JasperFillManager.fillReport(jasper, parameters, ds); if (format.equalsIgnoreCase("html")) { JasperExportManager.exportReportToHtmlFile(jasperPrint, path +"\\listOp.html"); } if (format.equalsIgnoreCase("pdf")) { JasperExportManager.exportReportToHtmlFile(jasperPrint, path +"\\listOp.pdf"); } return " Votre fichier est dans : "+path; } // recuperation de laliste operation private List<Operation> getOperation1() { List<Operation> o = new ArrayList<>(); for (Operation oper : cDa.listSimple()) { Map<String, Object> item = new HashMap<String, Object>(); item.put("dtypep", oper.getClass()); item.put("numero_operation", oper.getNumeroOperation()); item.put("date_operation", oper.getDateOperation()); item.put("montant", oper.getMontant()); item.put("designation", oper.getDesignation()); item.put("iddepot", oper.getDepo().getIdClient()); item.put("Caisse", oper.getCaisse().getCodeCaisse()); o.add(oper); } return o; }
Code XML : 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137 <?xml version="1.0" encoding="UTF-8"?> <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="OperList" language="groovy" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="2a20e923-268e-4547-9972-7dafed8a037a"> <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="0"/> <queryString> <![CDATA[]]> </queryString> <field name="class.simpleName" class="java.lang.String"> <fieldDescription><![CDATA[]]></fieldDescription> </field> <field name="numero_operation" class="java.lang.Long"> <fieldDescription><![CDATA[]]></fieldDescription> </field> <field name="date_operation" class="java.sql.Timestamp"> <fieldDescription><![CDATA[]]></fieldDescription> </field> <field name="designation" class="java.lang.String"> <fieldDescription><![CDATA[]]></fieldDescription> </field> <field name="montant" class="java.lang.Double"> <fieldDescription><![CDATA[]]></fieldDescription> </field> <field name="code_caisse" class="java.lang.String"> <fieldDescription><![CDATA[]]></fieldDescription> </field> <field name="iddepot" class="java.lang.Long"> <fieldDescription><![CDATA[]]></fieldDescription> </field> <field name="username" class="java.lang.String"> <fieldDescription><![CDATA[]]></fieldDescription> </field> <field name="dtype_op" class="java.lang.String"> <fieldDescription><![CDATA[]]></fieldDescription> </field> <background> <band splitType="Stretch"/> </background> <title> <band height="79" splitType="Stretch"/> </title> <pageHeader> <band height="35" splitType="Stretch"/> </pageHeader> <columnHeader> <band height="20" splitType="Stretch"> <staticText> <reportElement x="104" y="0" width="100" height="20" uuid="dc1534db-9f64-4b9c-8a2f-e89eca2821f0"/> <textElement textAlignment="Center"> <font size="12" isBold="true"/> </textElement> <text><![CDATA[dtype_op]]></text> </staticText> <staticText> <reportElement x="242" y="0" width="100" height="20" uuid="97f4876b-5408-4766-b9c5-29ad16a3367b"/> <textElement textAlignment="Center"> <font size="12" isBold="true"/> </textElement> <text><![CDATA[date_operation]]></text> </staticText> <staticText> <reportElement x="342" y="0" width="100" height="20" uuid="176e74bb-aed0-427a-888e-f5c5e39ec7e7"/> <textElement textAlignment="Center"> <font size="12" isBold="true"/> </textElement> <text><![CDATA[designation]]></text> </staticText> <staticText> <reportElement x="204" y="0" width="38" height="20" uuid="5f3d16f5-9586-4ebd-a391-70c92d5fea7e"/> <textElement textAlignment="Center"> <font size="12" isBold="true"/> </textElement> <text><![CDATA[numero_operation]]></text> </staticText> <staticText> <reportElement x="531" y="0" width="100" height="20" uuid="6632761e-617d-4044-91aa-3c3bd9d2640c"/> <textElement textAlignment="Center"> <font size="12" isBold="true"/> </textElement> <text><![CDATA[montant]]></text> </staticText> <staticText> <reportElement x="442" y="0" width="100" height="20" uuid="1f148ebe-aa27-4f65-9b05-24df51ba20e2"/> <textElement textAlignment="Center"> <font size="12" isBold="true"/> </textElement> <text><![CDATA[code_caisse]]></text> </staticText> </band> </columnHeader> <detail> <band height="21" splitType="Stretch"> <textField> <reportElement x="104" y="0" width="100" height="20" uuid="40fe391f-2387-4041-ac3e-e6ad32be26fa"/> <box> <topPen lineWidth="1.0"/> </box> <textElement textAlignment="Center"/> <textFieldExpression><![CDATA[$F{class.simpleName}]]></textFieldExpression> </textField> <textField> <reportElement x="242" y="0" width="100" height="20" uuid="869a7411-4bb9-4bc9-9e64-b2908c6c846d"/> <textElement textAlignment="Center"/> <textFieldExpression><![CDATA[$F{date_operation}]]></textFieldExpression> </textField> <textField> <reportElement x="342" y="0" width="100" height="20" uuid="c4ebf4a2-1397-4393-86b7-7ed6a1a36fb6"/> <textElement textAlignment="Center"/> <textFieldExpression><![CDATA[$F{designation}]]></textFieldExpression> </textField> <textField> <reportElement x="204" y="0" width="38" height="20" uuid="0a23a2ea-87eb-418c-b5ee-ad49f19f4479"/> <textElement textAlignment="Center"/> <textFieldExpression><![CDATA[$F{numero_operation}]]></textFieldExpression> </textField> <textField> <reportElement x="531" y="0" width="100" height="20" uuid="674b8212-e375-4f8e-b880-a05cd9c35570"/> <textElement textAlignment="Center"/> <textFieldExpression><![CDATA[$F{montant}]]></textFieldExpression> </textField> <textField> <reportElement x="442" y="0" width="89" height="20" uuid="c3a362a9-14c6-46d5-8b0e-b8e21f889c55"/> <textElement textAlignment="Center"/> <textFieldExpression><![CDATA[$F{code_caisse}]]></textFieldExpression> </textField> </band> </detail> <columnFooter> <band height="45" splitType="Stretch"/> </columnFooter> <pageFooter> <band height="54" splitType="Stretch"/> </pageFooter> <summary> <band height="42" splitType="Stretch"/> </summary> </jasperReport>
voila la résultat,
Code x : 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116 Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback. Thu Sep 10 09:35:09 CEST 2020 There was an unexpected error (type=Internal Server Error, status=500). Error retrieving field value from bean: . net.sf.jasperreports.engine.JRException: Error retrieving field value from bean: . at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getBeanProperty(JRAbstractBeanDataSource.java:205) at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getFieldValue(JRAbstractBeanDataSource.java:170) at net.sf.jasperreports.engine.data.JRBeanCollectionDataSource.getFieldValue(JRBeanCollectionDataSource.java:104) at net.sf.jasperreports.engine.fill.JRFillDataset.setOldValues(JRFillDataset.java:1501) at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:1402) at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:1378) at net.sf.jasperreports.engine.fill.JRBaseFiller.next(JRBaseFiller.java:1194) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:108) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:615) at net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:433) at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:162) at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:145) at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:758) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:1074) at com.king.report.ReportService.exportReportOperation(ReportService.java:143) at com.king.report.ReportClass.exportReportOperation(ReportClass.java:49) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:878) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:792) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) 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:53) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:118) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:158) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:117) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:92) at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:77) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) 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:202) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1589) 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.NoSuchMethodException: Unknown property '' on class 'class com.king.entities.Versement' at org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty(PropertyUtilsBean.java:1270) at org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:809) at org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:885) at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:464) at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getBeanProperty(JRAbstractBeanDataSource.java:185) ... 101 more
si la communauté peut m'aider a trouver une solution
Partager