发新话题
打印

checkbox 选择性批量打印(转)

checkbox 选择性批量打印(转)

http://blog.163.com/aili10000@12 ... 120097251041124662/ 原文出处 1、得到需要打印的checkbox列表,然后按需要选择 showbeanprint.jsp <%@ page language="java" pageEncoding="UTF-8"%> <% request.setCharacterEncoding("utf-8"); %> <% String base = request.getContextPath(); %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib uri="http://jsptags.com/tags/navigation/pager" prefix="pg"%>
基本信息列表
全选   添加   编辑    删除    
事件类别:
标题
时间
管理员
操作
ut value="${result.onetype}">ut>
ut value="${result.datetime}" />
ut value="${result.users}">ut>
    共有${counts.maxElements } 条记录,共 ${counts.maxPages }
2、打印控制java,从页面取得checkbox 所列 id 组合成sql语句查询出相应结果 printtest.java package com.chinaba.print; import java.io.IOException; import java.sql.SQLException; import java.util.List; import java.util.Map; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.sql.DataSource; import org.apache.commons.dbutils.QueryRunner; import org.apache.commons.dbutils.handlers.MapListHandler; public class printtest extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } /** * The doPost method of the servlet.
* * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=utf-8"); request.setCharacterEncoding("utf-8"); String[] chxSong = request.getParameterValues("chxSong"); List list; Context ctx; try { ctx = new InitialContext(); DataSource ds = (DataSource) ctx.lookup("java:/comp/env/jdbc/sqlserver"); QueryRunner qr = new QueryRunner(ds); String idss=""; String par=""; String para=""; for(int i=0;i; if (i==chxSong.length-1){ para = "id="+ids; }else { par ="id="+ids+" or "; } idss=par+para; } System.out.print(idss); String sql = "select * from shenlei.dbo.word where "+idss+""; System.out.println(sql); list = (List)qr.query(sql,null,new MapListHandler()); System.out.println(list); for(int j=0;j 打印报检单


中华人民共和国XX出入境检验检疫
X市出入境货物报检单




报检信息 报检号:  B530520109000020
出入境类别 入境 报检币种 人民币 报检时间 2009-04-14 10:39
报检人代码 B5305700006 报检人名称 金峡 报检人国籍 越南
证件类别 工作证 证件号码 6548754 联系电话 15102314789
来源国(地区) 越南 来源地备注   运输方式 其他(指人扛、牲畜驮运等)
目的国(地区) 中国 目的国备注   运输工具号  
序号 货物名称 HS编码 CIQ编码 原产国(地区) 数(重)量 计量单位 原始货值
1 荔枝 0810901000 04110799 越南 3000.0 千克 90000


中华人民共和国XX出入境检验检疫
X市出入境货物报检单




报检信息 报检号:  B530520109000020
出入境类别 入境 报检币种 人民币 报检时间 2009-04-14 10:39
报检人代码 B5305700006 报检人名称 金峡 报检人国籍 越南
证件类别 工作证 证件号码 6548754 联系电话 15102314789
来源国(地区) 越南 来源地备注   运输方式 其他(指人扛、牲畜驮运等)
目的国(地区) 中国 目的国备注   运输工具号  
序号 货物名称 HS编码 CIQ编码 原产国(地区) 数(重)量 计量单位 原始货值
1 荔枝 0810901000 04110799 越南 3000.0 千克 90000

     
 

TOP