快速业务通道

Apache Geronimo和Spring框架,第6部分:Spring MVC:使用Web视图技术 - 编程入门网

作者 佚名技术 来源 NET编程 浏览 发布时间 2012-06-14
ldPdfDocument(        Map model,        Document doc,        PdfWriter writer,        HttpServletRequest req,        HttpServletResponse resp)        throws Exception {      List phonebook = (List) model.get("phonebook");      String title = "Phone Book";      Paragraph h1 = new Paragraph(title, HEADLINE_FONT);      h1.setAlignment(Paragraph.ALIGN_CENTER);      doc.add(h1);      doc.add(new Paragraph(" "));      doc.add(new Paragraph(" "));      doc.add(new Paragraph(" "));      // We create a table for used criteria and extracting  information      PdfPTable table = new PdfPTable(NO_OF_COLUMNS);      int headerwidths[] = {20, 20, 20, 20, 20};      table.setWidths(headerwidths);      table.setWidthPercentage(100);      table.getDefaultCell().setBorderWidth(1);      table.getDefaultCell().setBorderColor(Color.black);      table.getDefaultCell().setPadding(3);      table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);      table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);      table.addCell(new Phrase("Name", DATA_HEAD_FONT));      table.addCell(new Phrase("Home Phone", DATA_HEAD_FONT));      table.addCell(new Phrase("Work Phone", DATA_HEAD_FONT));      table.addCell(new Phrase("Cell Phone", DATA_HEAD_FONT));      table.addCell(new Phrase("Email", DATA_HEAD_FONT));      // We set the above row as title      // and adjust properties for normal cells      table.setHeaderRows(1);      table.getDefaultCell().setBorderWidth(1);      // We iterate now on the Phonebook list       Iterator it = phonebook.iterator();      while(it.hasNext()) {        PhonebookEntry pEntry = (PhonebookEntry) it.next();        table.addCell(new Phrase(pEntry.getFirstName() + " " +   pEntry.getLastName(), TEXT_FONT));        table.addCell(new Phrase(pEntry.getHomeNumber(), TEXT_FONT));        table.addCell(new Phrase(pEntry.getWorkNumber(), TEXT_FONT));        table.addCell(new Phrase(pEntry.getCellNumber(), TEXT_FONT));        table.addCell(new Phrase(pEntry.getEmail(), TEXT_FONT));      }      doc.add(table);      doc.add(new Paragraph(" "));      doc.add(new Paragraph(" "));      doc.add(new Paragraph(" "));      doc.add(new Paragraph(" "));      String footerStr1 = "This example is developed to demonstrate the  Spring framework on the Geronimo Application Server.";      String footerStr2 = "This example is designed purely for demonstrating the capabilities of the framework. It should under no circumstances be 

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号