Implementation ideas:
Prepare to use ireport to design and compile the report template.
The server uses the JSP to populate the report content and get the print object.
The client uses the applet to complete the report printing process.
This implementation requires the client to install the JRE, and the printer driver.
The following steps are decomposed:
1. "Prepare" to use ireport to design and compile the report template.
ireport installation process slightly ....
Create 1 simple reports and compile them:
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/89/EC/wKiom1ghjNPQR_vZAAFL6EhpXlM261.png-wh_500x0-wm_3 -wmp_4-s_523760982.png "title=" P1.png "alt=" Wkiom1ghjnpqr_vzaafl6ehpxlm261.png-wh_50 "/>
2. The "Server Side" uses the JSP to complete the report content fill and obtains the Print object.
A. Introducing a dependent jar package in the project, depending on the component of the report may vary, only a few are referenced here based on the sample report.
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/89/EC/wKiom1ghjNTzmWn4AAASWzeBhTM334.png-wh_500x0-wm_3 -wmp_4-s_1558990681.png "title=" P2.png "alt=" Wkiom1ghjntzmwn4aaaswzebhtm334.png-wh_50 "/>
B. Write JSP page content:
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/89/E9/wKioL1ghjNXQ7X2wAAEvu5h4pIQ902.png-wh_500x0-wm_3 -wmp_4-s_866947863.png "title=" P3.png "alt=" Wkiol1ghjnxq7x2waaevu5h4piq902.png-wh_50 "/>
JSP page Design ideas:
The client submits the parameter list contains the report resource and the parameter list two parts, the report resource passes through the file parameter, the parameter list is the remaining parameter content of the submission, which is collated by the JSP code and forwarded to the report processing.
The JSP generates the Print object Jasperprint and returns.
3. The client uses the applet to complete the report printing process.
A. Writing an applet class
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/89/E9/wKioL1ghjNWxPFcNAAD6YDdRCmU791.png-wh_500x0-wm_3 -wmp_4-s_772682405.png "title=" P4.png "alt=" Wkiol1ghjnwxpfcnaad6yddrcmu791.png-wh_50 "/>
Applet Design Ideas:
Submit the HTTP request, the production process of the report to the server to complete, itself only accept the returned Jasperprint object, and complete the printing process.
B. Writing a browser to process code
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/89/EC/wKiom1ghjNbRnH6AAAFRVgLVLUA607.png-wh_500x0-wm_3 -wmp_4-s_323108657.png "title=" P5.png "alt=" Wkiom1ghjnbrnh6aaafrvglvlua607.png-wh_50 "/>
C. Completing the Client Configuration
The client configuration is determined by the version of the JRE and typically consists of 2 parts:%jre_home%/lib/security/java.policy and "Configure Java" secure Site settings.
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/89/EC/wKiom1ghjNeDOi_8AACYlKUEYNk137.png-wh_500x0-wm_3 -wmp_4-s_3193187325.png "title=" P6.png "alt=" Wkiom1ghjnedoi_8aacylkueynk137.png-wh_50 "/>
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/89/E9/wKioL1ghjNeSQ8VYAABXE3ZUoWc275.png-wh_500x0-wm_3 -wmp_4-s_2083539592.png "title=" P7.png "alt=" Wkiol1ghjnesq8vyaabxe3zuowc275.png-wh_50 "/>
4. Operation effect
Page Run Effect:
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/89/EC/wKiom1ghjNjD63cjAABCyFXWHkM388.png-wh_500x0-wm_3 -wmp_4-s_4111762867.png "title=" P8.png "alt=" Wkiom1ghjnjd63cjaabcyfxwhkm388.png-wh_50 "/>
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/89/EC/wKiom1ghjNiD1-qiAACVLa4j59k382.png-wh_500x0-wm_3 -wmp_4-s_3494165189.png "title=" P9.png "alt=" Wkiom1ghjnid1-qiaacvla4j59k382.png-wh_50 "/>
Click the button directly to generate the report.
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/89/E9/wKioL1ghjNnRz0ATAAC7USiLQvg453.png-wh_500x0-wm_3 -wmp_4-s_1451476827.png "title=" P10.png "alt=" Wkiol1ghjnnrz0ataac7usilqvg453.png-wh_50 "/>
To open the effect after saving:
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/89/EC/wKiom1ghjNmz7rDMAACO6xSCuqk135.png-wh_500x0-wm_3 -wmp_4-s_695601583.png "title=" P11.png "alt=" Wkiom1ghjnmz7rdmaaco6xscuqk135.png-wh_50 "/>
Add report parameter: &code=code1
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/89/E9/wKioL1ghjNqysTGhAABWYC9zYCM477.png-wh_500x0-wm_3 -wmp_4-s_955098193.png "title=" P12.png "alt=" Wkiol1ghjnqystghaabwyc9zycm477.png-wh_50 "/>
Click the button to generate the report
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/89/EC/wKiom1ghjNqw6-zoAAEYfkV887s545.png-wh_500x0-wm_3 -wmp_4-s_957869965.png "title=" P13.png "alt=" Wkiom1ghjnqw6-zoaaeyfkv887s545.png-wh_50 "/>
To open the effect after saving:
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/89/E9/wKioL1ghjOGBps6oAACKeJsukic423.png-wh_500x0-wm_3 -wmp_4-s_150661126.png "title=" P14.png "alt=" Wkiol1ghjogbps6oaackejsukic423.png-wh_50 "/>
Ireport+jasperreport+applet Report Printing