当前位置: 首页 > news >正文

做电力产品的外贸网站苏州百度 seo

做电力产品的外贸网站,苏州百度 seo,家纺营销型网站,个人网页设计与实现论文在此示例中#xff0c;我将展示如何将DynamicReport和JasperReports与Servlet和CDI集成。 工具#xff1a; TIBCO Jaspersoft Studio-6.0.4。最终版 Eclipse Luna服务版本2#xff08;4.4.2#xff09;。 WildFly 8.x应用程序服务器。 这是Eclipse上项目层次结构的屏幕… 在此示例中我将展示如何将DynamicReport和JasperReports与Servlet和CDI集成。 工具 TIBCO Jaspersoft Studio-6.0.4。最终版 Eclipse Luna服务版本24.4.2。 WildFly 8.x应用程序服务器。 这是Eclipse上项目层次结构的屏幕截图。 pom.xml文件包含Servlets JSF CDI DynamicReports所需的依赖项。 project xmlnshttp://maven.apache.org/POM/4.0.0 xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsdmodelVersion4.0.0/modelVersiongroupIdcom.ithinkisink/groupIdartifactIdDynamicReportsWithJSFServletsAndCDI/artifactIdpackagingwar/packagingversion0.0.1-SNAPSHOT/versionnameDynamicReportsWithJSFServletsAndCDI Maven Webapp/namedependenciesdependencygroupIdjavax.inject/groupIdartifactIdjavax.inject/artifactIdversion1/versionscopeprovided/scope/dependencydependencygroupIdjavax.faces/groupIdartifactIdjsf-api/artifactIdversion2.1/versionscopeprovided/scope/dependencydependencygroupIdjavax.servlet/groupIdartifactIdjavax.servlet-api/artifactIdversion3.1.0/versionscopeprovided/scope/dependencydependencygroupIdjavax.enterprise/groupIdartifactIdcdi-api/artifactIdversion1.0/versionscopeprovided/scope/dependencydependencygroupIdnet.sourceforge.dynamicreports/groupIdartifactIddynamicreports-core/artifactIdversion4.0.0/version/dependency/dependenciesbuildfinalNameDynamicReportsWithJSFServletsAndCDI/finalNamepluginsplugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-compiler-plugin/artifactIdversion3.1/versionconfigurationsource1.7/sourcetarget1.7/target/configuration/plugin/plugins/build /project 使用TIBCO Jaspersoft Studio创建一个简单的JRXML模板其中包含一个图像该图像随后将作为参数从DynamicReportsManagedBean动态传递到DynamicReports。 ?xml version1.0 encodingUTF-8? !-- Created with Jaspersoft Studio version 6.0.4.final using JasperReports Library version 6.0.4 -- !-- 2015-12-04T17:15:43 -- jasperReport xmlnshttp://jasperreports.sourceforge.net/jasperreports xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance xsi:schemaLocationhttp://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd nameInvoice pageWidth595 pageHeight842 columnWidth535 leftMargin20 rightMargin20 topMargin20 bottomMargin20 uuid4eedbb89-b4f6-4469-9ab6-f642a1688cf7property namecom.jaspersoft.studio.data.defaultdataadapter valueOne Empty Record/style nameTitle forecolor#FFFFFF fontNameTimes New Roman fontSize50 isBoldfalse pdfFontNameTimes-Bold/style nameSubTitle forecolor#CCCCCC fontNameTimes New Roman fontSize18 isBoldfalse pdfFontNameTimes-Roman/style nameColumn header forecolor#666666 fontNameTimes New Roman fontSize14 isBoldtrue/style nameDetail modeTransparent fontNameTimes New Roman/style nameRow modeTransparent fontNameTimes New Roman pdfFontNameTimes-RomanconditionalStyleconditionExpression![CDATA[$V{REPORT_COUNT}%2 0]]/conditionExpressionstyle modeOpaque backcolor#EEEFF0//conditionalStyle/stylestyle nameTableboxpen lineWidth1.0 lineColor#000000/topPen lineWidth1.0 lineColor#000000/leftPen lineWidth1.0 lineColor#000000/bottomPen lineWidth1.0 lineColor#000000/rightPen lineWidth1.0 lineColor#000000//box/stylestyle nameTable_TH modeOpaque backcolor#FFFFFFboxpen lineWidth0.5 lineColor#000000/topPen lineWidth0.5 lineColor#000000/leftPen lineWidth0.5 lineColor#000000/bottomPen lineWidth0.5 lineColor#000000/rightPen lineWidth0.5 lineColor#000000//box/stylestyle nameTable_CH modeOpaque backcolor#CACED0boxpen lineWidth0.5 lineColor#000000/topPen lineWidth0.5 lineColor#000000/leftPen lineWidth0.5 lineColor#000000/bottomPen lineWidth0.5 lineColor#000000/rightPen lineWidth0.5 lineColor#000000//box/stylestyle nameTable_TD modeOpaque backcolor#FFFFFFboxpen lineWidth0.5 lineColor#000000/topPen lineWidth0.5 lineColor#000000/leftPen lineWidth0.5 lineColor#000000/bottomPen lineWidth0.5 lineColor#000000/rightPen lineWidth0.5 lineColor#000000//boxconditionalStyleconditionExpression![CDATA[$V{REPORT_COUNT}%2 0]]/conditionExpressionstyle backcolor#D8D8D8//conditionalStyle/stylesubDataset nametableDataset uuidf13e6d36-5148-4ecc-bbe3-3035def80980queryString![CDATA[]]/queryString/subDatasetparameter nameinvoiceNo classjava.lang.String/parameter namebillingCompanyName classjava.lang.String/parameter namebillingCompanyAddress classjava.lang.String/parameter namebillingCompanyFirstState classjava.lang.String/parameter namebillingCompanySecondState classjava.lang.String/parameter nameshippingName classjava.lang.String/parameter nameshippingAddress classjava.lang.String/parameter nameshippingFirstState classjava.lang.String/parameter nameshippingSecondState classjava.lang.String/parameter nameIMAGE_PATH classjava.lang.String/queryString languageSQL![CDATA[]]/queryStringfield nameitemNo classjava.lang.String/field namedescription classjava.lang.String/field nameunitCost classjava.lang.Double/field namequantity classjava.lang.Integer/group nameGruppo1groupExpression![CDATA[(int)($V{REPORT_COUNT}/15)]]/groupExpressiongroupHeaderband//groupHeadergroupFooterbandproperty namelocal_mesure_unitheight valuepixel/property namecom.jaspersoft.studio.unit.height valuepx//band/groupFooter/grouptitleband height196 splitTypeStretchstaticTextreportElement x0 y90 width84 height25 uuid57aed2b1-4f4e-40a3-a6ad-54dae8dd4c5aproperty namelocal_mesure_unitheight valuepixel/property namecom.jaspersoft.studio.unit.height valuepx//reportElementtextElementfont size16 isBoldtrue//textElementtext![CDATA[Bill to:]]/text/staticTextlinereportElement x0 y80 width556 height1 uuid806ce5df-1219-4876-ae0c-ca7405b1f246property namelocal_mesure_unitheight valuepixel/property namecom.jaspersoft.studio.unit.height valuepx//reportElement/linestaticTextreportElement x400 y90 width84 height25 uuid139ebe8d-25b0-411e-986c-270015400874property namelocal_mesure_unitheight valuepixel/property namecom.jaspersoft.studio.unit.height valuepx//reportElementtextElementfont size16 isBoldtrue//textElementtext![CDATA[Ship to:]]/text/staticTextstaticTextreportElement x415 y10 width50 height20 uuid0f86baff-6386-4f3f-b3fe-2388707babe8/box rightPadding4/textElement textAlignmentRight/text![CDATA[Date:]]/text/staticTexttextField patternEEEEE dd MMMMM yyyyreportElement x465 y10 width84 height20 uuidbb10dbe1-0a4f-4722-9953-c163b63cf979/textFieldExpression![CDATA[new java.util.Date()]]/textFieldExpression/textFieldimage hAlignCenterreportElement x0 y0 width65 height60 uuid94883631-a913-43e2-b182-ab8d77d0181e/imageExpression![CDATA[$P{IMAGE_PATH} /invoice_logo.png]]/imageExpression/imagetextField patternEEEEE dd MMMMM yyyyreportElement x465 y30 width84 height20 uuid3836ce65-eca3-4cad-a6de-b1818def0a2b/textFieldExpression![CDATA[$P{invoiceNo}]]/textFieldExpression/textFieldstaticTextreportElement x415 y30 width50 height20 uuid0b3f9342-da78-4cfa-9fc5-2301c4749678/box rightPadding4/textElement textAlignmentRight/text![CDATA[Invoice #]]/text/staticTextstaticTextreportElement x95 y0 width210 height25 uuide622555d-198b-4ccd-a4a1-c59c53304058property namelocal_mesure_unitheight valuepixel/property namecom.jaspersoft.studio.unit.height valuepx//reportElementtextElementfont size19 isBoldtrue//textElementtext![CDATA[I think, I sink!]]/text/staticTextstaticTextreportElement x95 y55 width205 height15 uuidb8cc42fd-b569-497d-834d-7e854040ad18/text![CDATA[20 10 000 0000]]/text/staticTextstaticTextreportElement x95 y25 width205 height15 uuidc226e44d-3bb5-4145-b0b3-903bf1d79fde/text![CDATA[Sesame street]]/text/staticTextstaticTextreportElement x95 y40 width205 height15 uuidb96f7183-44f8-43ad-ba60-43d8fbf50b6e/text![CDATA[Sesame city]]/text/staticTexttextFieldreportElement x0 y115 width150 height15 uuid7e9e0af2-08d1-4997-b3e1-971e74b1c8adproperty namelocal_mesure_unitheight valuepixel/property namecom.jaspersoft.studio.unit.height valuepx//reportElementtextFieldExpression![CDATA[$P{billingCompanyName}]]/textFieldExpression/textFieldtextFieldreportElement x0 y130 width150 height15 uuida0eaddab-ed2f-46fc-b9fc-d0d9747c6df3property namelocal_mesure_unitheight valuepixel/property namecom.jaspersoft.studio.unit.height valuepx//reportElementtextFieldExpression![CDATA[$P{billingCompanyAddress}]]/textFieldExpression/textFieldtextFieldreportElement x0 y145 width150 height15 uuidf9371f1e-125e-408d-a0f0-aa0ea5adc171property namelocal_mesure_unitheight valuepixel/property namecom.jaspersoft.studio.unit.height valuepx//reportElementtextFieldExpression![CDATA[$P{billingCompanyFirstState}]]/textFieldExpression/textFieldtextFieldreportElement x0 y160 width150 height15 uuidc14d7758-80e6-45d7-8526-797330e515d3property namelocal_mesure_unitheight valuepixel/property namecom.jaspersoft.studio.unit.height valuepx//reportElementtextFieldExpression![CDATA[$P{billingCompanySecondState}]]/textFieldExpression/textFieldtextFieldreportElement x400 y160 width140 height15 uuida9baefea-45b3-4826-a81e-3572507eea6dproperty namelocal_mesure_unitheight valuepixel/property namecom.jaspersoft.studio.unit.height valuepx//reportElementtextFieldExpression![CDATA[$P{shippingSecondState}]]/textFieldExpression/textFieldtextFieldreportElement x400 y145 width140 height15 uuid338e1f40-9a03-4b77-aedc-568b1907628bproperty namelocal_mesure_unitheight valuepixel/property namecom.jaspersoft.studio.unit.height valuepx//reportElementtextFieldExpression![CDATA[$P{shippingFirstState}]]/textFieldExpression/textFieldtextFieldreportElement x400 y130 width140 height15 uuid54e6473f-44ef-4839-8f87-29e65af72561property namelocal_mesure_unitheight valuepixel/property namecom.jaspersoft.studio.unit.height valuepx//reportElementtextFieldExpression![CDATA[$P{shippingAddress}]]/textFieldExpression/textFieldtextFieldreportElement x400 y115 width140 height15 uuid1f093c2e-2d6f-403e-9c11-160dbaf82e6fproperty namelocal_mesure_unitheight valuepixel/property namecom.jaspersoft.studio.unit.height valuepx//reportElementtextFieldExpression![CDATA[$P{shippingName}]]/textFieldExpression/textField/band/titlecolumnHeaderband height24staticTextreportElement x366 y4 width80 height20 uuidbe792358-dade-4931-965d-fe4d4958b71c/textElement textAlignmentCenterfont size12 isBoldfalse//textElementtext![CDATA[Quantity]]/text/staticTextrectanglereportElement modeOpaque x10 y2 width531 height20 backcolor#C0D4EC uuidce42b0b0-0d12-48c1-8020-576969255150/graphicElementpen lineColor#666666//graphicElement/rectanglestaticTextreportElement x430 y3 width111 height18 uuid95b85246-2e67-42d0-9e41-987314cddba0/textElement textAlignmentCenterfont size12 isBoldfalse//textElementtext![CDATA[Price $]]/text/staticTextstaticTextreportElement x261 y3 width80 height20 uuid40050754-f800-4283-a0ed-64894f5652a2/textElement textAlignmentCenterfont size12 isBoldfalse//textElementtext![CDATA[Unit Cost $]]/text/staticTextstaticTextreportElement x10 y3 width50 height20 uuid299467fd-8d2b-48b0-af5b-769cc9d9bb37/textElement textAlignmentCenterfont size12 isBoldfalse//textElementtext![CDATA[Item]]/text/staticTextstaticTextreportElement x71 y2 width179 height20 uuid9818ad45-9dc2-4e62-821c-953f3801de84/textElement textAlignmentCenterfont size12 isBoldfalse//textElementtext![CDATA[Description]]/text/staticTextstaticTextreportElement x347 y3 width80 height20 uuidf10ae7d8-7499-404a-a1ab-a2ce63b22b3b/textElement textAlignmentCenterfont size12 isBoldfalse//textElementtext![CDATA[Quantity]]/text/staticText/band/columnHeaderdetailband height29textFieldreportElement x11 y5 width54 height20 uuid0cd6aa63-bd20-45fb-8543-51931badd2fc/textElement textAlignmentLeft/textFieldExpression![CDATA[$F{itemNo}]]/textFieldExpression/textFieldtextFieldreportElement x70 y5 width180 height20 uuid1be950c3-370a-43fa-9510-2ee8db740774/textElement textAlignmentLeft/textFieldExpression![CDATA[$F{description}]]/textFieldExpression/textFieldtextFieldreportElement x261 y5 width80 height20 uuid3637c327-f832-4e7c-bb82-4cf41e607ca6/textElement textAlignmentLeft/textFieldExpression![CDATA[$F{unitCost}]]/textFieldExpression/textFieldtextFieldreportElement x347 y5 width80 height20 uuide9bfe6dc-7101-4d22-90a7-4766122c4e8a/textElement textAlignmentLeft/textFieldExpression![CDATA[$F{quantity}]]/textFieldExpression/textFieldtextFieldreportElement x430 y5 width118 height20 uuid77c9d024-651d-4207-9f32-8637cd4dd449/textElement textAlignmentLeft/textFieldExpression![CDATA[$F{unitCost} * $F{quantity}]]/textFieldExpression/textField/band/detaillastPageFooterband height177staticTextreportElement positionTypeFloat x-1 y30 width261 height101 uuid1a0d7088-5af7-4865-8be1-41ec5f51fb36/boxtopPen lineWidth1.1 lineStyleDashed/leftPen lineWidth1.1 lineStyleDashed/bottomPen lineWidth1.1 lineStyleDashed/rightPen lineWidth1.1 lineStyleDashed//boxtext![CDATA[Your notes here]]/text/staticTextstaticTextreportElement positionTypeFloat modeOpaque x0 y147 width556 height30 backcolor#E6E8E9 uuid36aa233d-4305-48e6-974a-1bbf89bb3c8f/textElement textAlignmentCenter verticalAlignmentMiddlefont fontNameSerif size9 isItalictrue//textElementtext![CDATA[THANKYOU FOR YOUR BUSINESS]]/text/staticText/band/lastPageFooter /jasperReport 创建一个Item类它将作为模型对象其中包含要绑定到JRXML模板字段的数据。 另外我创建了一个InvoiceDetails类该类具有将绑定到JRXML模板参数的数据。 package com.ithinkisink.model;/*** * author Belal**/ public class Item {private String itemNo;private String description;private double unitCost;private int quantity;public Item(String itemNo, String description, double unitCost, int quantity) {super();this.itemNo itemNo;this.description description;this.unitCost unitCost;this.quantity quantity;}public String getItemNo() {return itemNo;}public void setItemNo(String itemNo) {this.itemNo itemNo;}public String getDescription() {return description;}public void setDescription(String description) {this.description description;}public double getUnitCost() {return unitCost;}public void setUnitCost(double unitCost) {this.unitCost unitCost;}public int getQuantity() {return quantity;}public void setQuantity(int quantity) {this.quantity quantity;} } DynamicReportsManagedBean将负责准备参数列表和包含将绑定到JRXML字段的Lis​​t Item的JRBeanCollectionDataSource。 package com.ithinkisink.managedbean;import static net.sf.dynamicreports.report.builder.DynamicReports.report;import java.io.InputStream; import java.io.OutputStream; import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map;import javax.annotation.PostConstruct; import javax.enterprise.context.SessionScoped; import javax.inject.Named; import javax.servlet.ServletContext;import net.sf.dynamicreports.report.exception.DRException; import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;import com.ithinkisink.model.InvoiceDetails; import com.ithinkisink.model.Item;/*** * author Belal**/ Named SessionScoped public class DynamicReportsManagedBean implements Serializable {private static final long serialVersionUID -1;private String invoiceName;private JRBeanCollectionDataSource beanCollectionDataSource;private MapString, Object parameters;PostConstructpublic void init() {invoiceNameInvoice.jrxml;ListItem itemList new ArrayList(Arrays.asList(new Item(01, Item 01 description, 1.1, 1), new Item(02, Item 02 description, 2.2, 2),new Item(03, Item 03 description, 3.3, 3)));beanCollectionDataSource new JRBeanCollectionDataSource(itemList);parameters (new InvoiceDetails(INV#01, Billing Company, Billing Company Add, Billing Company State 1, Billing Company State 2, Shipping Name, Shipping Address, Shipping State 1, Shipping State 2, 1000)).toMap();}/*** Preparing an output stream of the generated PDF invoice.* * return*/public OutputStream getOS(ServletContext context, OutputStream outputStream) {parameters.put(IMAGE_PATH, context.getRealPath(/jasper/invoices));InputStream is context.getResourceAsStream(/jasper/invoices/ invoiceName);try {report().setTemplateDesign(is).setDataSource(beanCollectionDataSource).setParameters(parameters).toPdf(outputStream);} catch (DRException e) {e.printStackTrace();}return outputStream;}// setters and getterspublic String getInvoiceName() {return invoiceName;}public void setInvoiceName(String invoiceName) {this.invoiceName invoiceName;}public JRBeanCollectionDataSource getBeanCollectionDataSource() {return beanCollectionDataSource;}public void setBeanCollectionDataSource(JRBeanCollectionDataSource beanCollectionDataSource) {this.beanCollectionDataSource beanCollectionDataSource;}public void setParameters(MapString, Object parameters) {this.parameters parameters;}public MapString, Object getParameters() {return parameters;} } CDI使我们能够将DynamicReportsManagedBean的实例注入到DynamicReportsServlet。 Servlet将处理响应输出流该响应输出流将显示从模板的DynamicReports创建的输出流。 package com.ithinkisink.servlet;import java.io.IOException; import java.io.OutputStream;import javax.inject.Inject; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;import com.ithinkisink.managedbean.DynamicReportsManagedBean;/*** * author Belal**/ public class DynamicReportsServlet extends HttpServlet {private static final long serialVersionUID 1L;Injectprivate DynamicReportsManagedBean dynamicReportsManagedBean;Overrideprotected void doGet(HttpServletRequest req, HttpServletResponse resp)throws ServletException, IOException {resp.setContentType(application/pdf);OutputStream out resp.getOutputStream();out dynamicReportsManagedBean.getOS(getServletContext(), out);out.close();}Overrideprotected void doPost(HttpServletRequest req, HttpServletResponse resp)throws ServletException, IOException {super.doPost(req, resp);this.doGet(req, resp);}public void setDynamicReportsManagedBean(DynamicReportsManagedBean dynamicReportsManagedBean) {this.dynamicReportsManagedBean dynamicReportsManagedBean;}public DynamicReportsManagedBean getDynamicReportsManagedBean() {return dynamicReportsManagedBean;} } 在将servlet添加到web.xml中时我更喜欢老派。 ?xml version1.0 encodingUTF-8? web-app version3.0 xmlnshttp://java.sun.com/xml/ns/javaeexmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsddisplay-nameDynamicReportsWithJSFServletsAndCDI Maven Webapp/display-nameservletdescription/descriptiondisplay-nameDynamicReportsServlet/display-nameservlet-nameDynamicReportsServlet/servlet-nameservlet-classcom.ithinkisink.servlet.DynamicReportsServlet/servlet-class/servletservlet-mappingservlet-nameDynamicReportsServlet/servlet-nameurl-pattern/*/url-pattern/servlet-mappingwelcome-file-listwelcome-file/index.xhtml/welcome-file/welcome-file-list /web-app index.xhtml包含一个指向servlet的iframe。 !DOCTYPE html html xmlnshttp://www.w3.org/1999/xhtmlxmlns:hhttp://java.sun.com/jsf/htmlh:headtitleDynamicReports with Servlets, JSF and CDI/title /h:headh:bodyh:formiframe namereceipt height600 idtheIFrame width100%srchttp://localhost:8080/DynamicReportsWithJSFServletsAndCDI //h:form /h:body/html 通过运行示例的最终输出。 您可以从以下链接在我的Github上找到完整的示例 https : //github.com/belalgalal/Blogging/tree/master/DynamicReportsWithJSFServletsAndCDI 翻译自: https://www.javacodegeeks.com/2016/02/dynamicreports-jasperreports-jsf-servlet-cdi.html
http://wiki.neutronadmin.com/news/174990/

相关文章:

  • 网站横幅怎么更换电商平台建设做网站
  • 家具网站建设规划书wordpress淘宝客主题破解版
  • 网站推广方法大全有哪些网站可以用
  • 营销型网站特点闸北微信网站建设
  • 建设银行网站上改手机号码网站建设 教程
  • 山西建设厅网站查不了怎么做废品网站
  • 北京欢迎您网站建设网站建设设计制作公司
  • 织梦网站程序模板下载开的免费网站能赚钱吗
  • 下载站源码cmswordpress仿站js如何导入
  • 东莞网站制作搭建会员制网站 建设
  • 如何入侵网站后台工作啦
  • 网站开发一次性费用长沙seo霸屏
  • 英德市住房和城乡建设局手机网站wordpress qq邮件订阅
  • 百度站长之家工具自己做返利网站吗
  • 软件开发和网站开发难度网站概述怎么写
  • 深圳最专业的高端网站建设wordpress本地无法打开
  • 好用的种子搜索引擎外贸seo是什么
  • 网站大全app下载jsp网站 自动发送邮件
  • 能打开那种网站的手机浏览器工业设计公司怎么收费
  • 金山网站制作建设网站经营范围
  • 杭州市建设银行网站两个人做类似的梦 网站
  • 哪家做网站的西安网站制作一般多少钱
  • 十大网站建设江苏网站备案流程
  • 芙蓉区建设局网站网站建设与管理教学计划
  • 网站视觉首页怎么做中国室内设计网官网总裁
  • asp.net3.5网站开发实例教程中山自助建站系统
  • 网站网页设计引言跨境电商有哪些平台
  • 家装网站建设哪家好点百度123123网址大全
  • 网站名称 如何注册濮阳做网站星月网络
  • 企业网站规划方案wordpress 手机模板