怎么用jsf实现图片上传并显示功能
相关推荐
jsf实现登录功能
这是一个使用jsf框架实现简易登录功能的小例子,对于初学者可以参考一下。
JSF中使用BooleanCheckbox实现全选功能
NULL 博文链接:https://sailinglee.iteye.com/blog/429696
JSF文件下载实现
JSF实现文件的下载功能 public static void downloadFile(String path,String fileName) { try { // 获得JSF上下文环境 FacesContext context = FacesContext.getCurrentInstance(); // 获得ServletContext对象 ServletContext servletContext = (ServletContext) context .getExternalContext().getContext(); // 取得文件的绝对路径 String realName = servletContext.getRealPath(path) + "/" + fileName; HttpServletResponse httpServletResponse = (HttpServletResponse) FacesContext .getCurrentInstance().getExternalContext().getResponse(); downloadFile(httpServletResponse,realName,fileName); } catch (IOException e) { e.printStackTrace(); } FacesContext.getCurrentInstance().responseComplete(); } public static void downloadFile(HttpServletResponse response,String realName,String fileName) throws IOException { response.setHeader("Content-disposition", "attachment; filename=" + fileName); response.setContentType("application/x-download"); //File exportFile = new File(realName); //response.setContentLength((int) exportFile.length()); ServletOutputStream servletOutputStream = response.getOutputStream(); byte[] b = new byte[1024]; int i = 0; FileInputStream fis = new java.io.FileInputStream(realName); while ((i = fis.read(b)) > 0) { servletOutputStream.write(b, 0, i); } } 使用方法 1、在backing bean的方法中调用函数1即可。如Abean中download方法调用了该方法,前台可以这样调用: 或者 2、jsp页面可以这样调用: 于是jsf页面我们可以借助outputlink来调用该页面
poi读取并导出excel(jsf bean 页面的实现)
实现通过poi读取并导出excel,可以实现下载地址是可选的,不是写死的
利用自定义渲染器实现JSF数据库表分页显示
核心JSF编程提出了一个自定义渲染器实现分页显示大量数据的技术,对该书的代码进行改进和增强后可以得到一个功能强大、使用简单的分页标签。 本资源包含了该分页标签全部的修改后的代码、配置文件示例、使用方法示例以及对代码的有关说明,掌握本资源的内容,从此JSF分页可以一劳永逸。


Web 开发
