zoukankan      html  css  js  c++  java
  • java_web总结(一)

    1、struts1ajax返回值

         

    	public ActionForward preChangeAccountPwd(ActionMapping mapping,
    			ActionForm form, HttpServletRequest request,
    			HttpServletResponse response) throws Exception {
                   // 向页面返回添加帐号结果
    		response.setCharacterEncoding("UTF-8");
    		response.setContentType("text/html; charset=UTF-8");
    		PrintWriter  pw = response.getWriter();
    		pw.write(result);
    		pw.close();
                    return null;
    }        
    

    2、excle

    response.setHeader("Content-disposition","attachment;filename=temp.xls"); 
    response.setContentType("application/octet-stream");
    ServletOutputStream os = response.getOutputStream();
    NetWorkForm uf = (NetWorkForm)form;
    FormFile ff = uf.getNetFile();
    InputStream in = ff.getInputStream();
    HSSFWorkbook wb = new HSSFWorkbook(in);
    HSSFSheet sheet = wb.getSheetAt(0);
    int rowNum = sheet.getLastRowNum();
    ×
    ×
    workbook.write(os);
    os.close();
    in.close();
    return null;
    ========================
    OutputStream os = response.getOutputStream();
    response.setContentType("application/vnd.ms-excel");
    response.setHeader("Content-disposition", "attachment; filename="+ fileName+ ".xls");
    // 第一步,创建一个webbook,对应一个Excel文件
    HSSFWorkbook wb = new HSSFWorkbook();
    ×
    ×
    wb.write(os);
    os.close();
    response.setContentType("text/xml;charset=utf-8");
    return null;
    

        

         

  • 相关阅读:
    过度和动画
    自定义指令
    使用ref操作DOM和过滤器的使用
    计算属性与侦听器
    MVVM设计思想
    vue template
    Vue初探
    npm 6.14 + Babel 7 使用
    5行代码起一个服务
    vue打包后引入js和css用相对路径引入
  • 原文地址:https://www.cnblogs.com/caroline4lc/p/3922673.html
Copyright © 2011-2022 走看看