- 浏览: 562512 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (411)
- webservice (3)
- oracle (37)
- sqlserver (8)
- j2ee (56)
- linux (7)
- javaweb (47)
- office (1)
- struts (23)
- hibernate (11)
- spring (29)
- 网络 (2)
- tomcat (13)
- tongweb (0)
- weblogic (0)
- powerdesiginer (3)
- svn (3)
- js (20)
- ie (2)
- 编译 (3)
- css (2)
- 操作系统 (5)
- Android (41)
- jbpm4.3 (1)
- fckeditor (3)
- 操作excel (2)
- db2常用命令 (1)
- ibatis (5)
- mysql (16)
- 表达式语言 (1)
- java方式调用存储过程 (1)
- ca (1)
- linux客户端 (1)
- 电子数码 (1)
- 行业应用 (12)
- 开发工具 (4)
- 面试 (1)
- 计算机原理 (1)
- NOSQL (5)
- 虚拟机 (1)
- nginx (0)
- velocity (2)
- jndi (1)
- spring mvc (39)
- springmvc (32)
- 安全 (5)
- htmleditor (6)
- iphone4 (1)
- html (4)
- jstl (2)
- ckeditor (5)
- 连接池 (1)
- jquery (6)
- 分页 (1)
- 技术研发规则 (1)
- javamail (1)
- maven (2)
- upload (1)
- log (1)
- 测试 (10)
- spring roo (1)
- 版本控制 (2)
- find bugs (0)
- jsf (0)
- springroo (0)
- 小道理 (1)
- 小道理,技术标准 (1)
- jsf (0)
- bitbao (2)
- redmine (3)
- 团队意识 (1)
- mybatis (2)
- jquery mobile (1)
- flexpaper (0)
- json (4)
- URLRewriteFilte (1)
- html5 (1)
- 都乐保活动 (0)
- openfire (0)
- TreeMap (1)
- build (0)
- javaweb,tag (0)
- algorithm (1)
- tag (2)
- 扯淡 (0)
- mac (2)
- 叶一火(老一) (1)
- 游玩 (1)
- 编码 (1)
- 上线部署 (0)
- 研发管理 (0)
- thumbnailator (2)
- 旅游 (0)
- bingweibo (1)
- 杂谈 (4)
- ktv (1)
- weibo (1)
- 爱情 (2)
- 饮食 (1)
- MediaWiki (1)
- git (1)
- 版本库 (1)
- servlet (1)
- 感悟 (1)
- 人生 (1)
- highcharts (1)
- poi (0)
- websphere (0)
- php (1)
最新评论
-
woshixushigang:
good
org.springframework.beans.TypeMismatchException: Failed to convert property valu -
nathanleewei:
org.springframework.jdbc.core.B ...
org.springframework.beans.TypeMismatchException: Failed to convert property valu -
浪禾木:
请问是ckeditor\contents.css吗?改过以后 ...
ckeditor自动换行问题 -
simusuishi:
刚哥威武!
ckeditor取值赋值问题 -
a455642158:
收割完毕……
Android开源项目源码下载(不断更新中)
/** * 保存个人风采 * * @throws IOException * */ @RequestMapping(value = "/saveImgs1") public String saveImgs(ModelMap modelMap) { /* 权限验证 */ int uid = this.user.get().getUid(); if (this.user.get().getUid() <= 0) { return "redirect:/error/index?code=auth.unlogin"; } // 允许上传的文件格式的列表JPG、JPEG、GIF、BMP final String[] allowtype = new String[] { ".JPG", ".JPEG", ".GIF", ".BMP", ".PNG", ".jpg", ".jpeg", ".gif", ".bmp", ".png" }; try { String realPath = CMConfig.getProperty("newstempurl"); // 文件上传的绝对路径 File fileDir = new File(realPath); if (!fileDir.exists()) { fileDir.mkdirs(); } request.get().setCharacterEncoding("UTF-8"); MultipartRequest mr = new MultipartRequest(request.get(), realPath, 4194304, "UTF-8"); // mr.get String filename = ""; String description = ""; Enumeration filesname = mr.getFileNames(); Enumeration filesdesc = mr.getParameterNames(); String newImgPath = ""; // 新图片路径 String url = ""; // 保存图片的url while (filesname.hasMoreElements()) { String name = (String) filesname.nextElement(); String dc = (String) filesdesc.nextElement(); filename = mr.getFilesystemName(name); description = mr.getParameter(dc); // filedName = (String) filesname.nextElement();// 文件文本框的名称 File uploadFile = mr.getFile(name); if (null != uploadFile && uploadFile.length() > 0) { String imgPath = uploadFile.getName(); // imgPath为原文件名 int idx = imgPath.lastIndexOf("."); // 文件后缀 String extention = imgPath.substring(idx); java.util.Date dt = new java.util.Date( System.currentTimeMillis()); SimpleDateFormat fmt = new SimpleDateFormat( "yyyyMMddHHmmss"); Long now = System.currentTimeMillis(); String time = fmt.format(dt) + String.valueOf(now); // 新的文件名(日期+后缀) newImgPath = this.user.get().getUid() + "_" + time + extention; int allowFlag = 0; int allowedExtCount = allowtype.length; for (; allowFlag < allowedExtCount; allowFlag++) { if (allowtype[allowFlag].equals(extention)) break; } if (allowFlag == allowedExtCount) { String message = ""; for (allowFlag = 0; allowFlag < allowedExtCount; allowFlag++) { message += "*" + allowtype[allowFlag] + " "; } logger.debug(extention + "message:'请上传以下类型的文件" + message + "'"); return "redirect:/account/personal_style?exception=imgtoolong"; } File f = new File(fileDir + "/" + newImgPath); uploadFile.renameTo(f); Date d = new Date(now); String year = DateUtil.dateToString(d, "yyyy"); String month = DateUtil.dateToString(d, "MM"); String day = DateUtil.dateToString(d, "dd"); url = CMConfig.getProperty("image.upload.url") + "/" + year + "/" + month + "/" + day + "/" + newImgPath; FileMove.move(CMConfig.getProperty("newstempurl") + newImgPath, CMConfig.getProperty("newsurl"), newImgPath); } } UDBUserDao userDao = AppContext .getBean("userDao", UDBUserDao.class); if (url.trim().length() == 0) { return "redirect:/account/personal_style?exception=imgnotnull"; } else { if (userDao.initSelfStyle(uid, url) > 0) { // 增加积分 ScoreService scoreService = AppContext.getBean( "scoreService", ScoreService.class); scoreService.addScore(this.user.get().getUid(), ScoreRuleType.ADD_STYLE, 0); return "redirect:/account/personal_style?exception=success"; } else { return "redirect:/account/personal_style?exception=error"; } } } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { logger.debug("**************************************************"); logger.debug("个人风采图片上传大小超过4M"); logger.debug("**************************************************"); return "redirect:/account/personal_style?exception=imgtoolong"; } this.model.get().addAttribute("title", "个人风采_账号设置_" + CMConfig.getProperty("default.title")); return "redirect:/account/personal_style"; }
发表评论
-
RESTFUL
2013-05-29 17:21 0a -
hibernate命名查询问题
2013-01-30 16:38 1278hibernate 注解 @OneToOne(fetc ... -
hibernate [Null value was assigned to a property of primitive type setter of sco
2012-12-25 19:51 1075今天开发时候 hibernate 查询报错,分析原因如下: ... -
Arrays.asList详解
2012-09-10 09:52 855Arrays.asList详解 记得以前写过一 ... -
mapper.readValue读取null
2012-08-17 19:21 2482如下代码,这样写不会走catch方法,此方法不报ioExcep ... -
string.split(",")返回的长度问题
2012-08-17 15:38 882String test = "#我的测试#&q ... -
thumbnailator 图片缩放问题
2012-08-17 19:29 2665这段代码上传1.7m图片会报错: publ ... -
模拟微博新鲜事短网址处理方式
2012-08-16 17:40 0a -
新鲜事短连接
2012-08-19 12:01 920现在需求如下: 使 ... -
jackson objectMapper.readValue 读取并存成想要的类型
2012-07-26 20:16 3609两种方式: java反射里面有个很有趣的东东,反射解析成li ... -
spring mvc responseBody 会把特殊字符转义
2012-07-26 19:53 4444框架用的spring 采用spring mvc 方式进行图片上 ... -
Out of range value for column 'bindUid' at row 1
2012-07-19 20:35 1458今天弄新浪微博绑定,数据库oauth_token表需要插入bi ... -
spring mvc 自己遇到的几个错误
2012-06-13 14:36 1165where 1=1 and t.name like '%&q ... -
Request method 'POST' not supported
2012-06-08 10:53 5165项目采用spring mvc框架实现,插入数据时候采用 ... -
beanPropertyRowMapper
2012-08-10 11:24 1025@SuppressWarnings(&quo ... -
org.codehaus.jackson.map.JsonMappingException
2012-08-17 19:30 909当一个类的所有属性都没有getter时(所有属性都是publi ... -
validApiToken
2012-08-10 11:26 930/** * 检验token的有效性 * @p ... -
split
2012-05-23 10:46 1159//String[] idArr = StringUtil ... -
spring mvc title展示的几种写法
2012-05-18 17:16 1054我记录的是工作中遇到的,容易忽视的问题,高手可以绕行了。积累也 ... -
c:import src="" jsp页面同步方式获取数据
2012-05-14 11:28 1043可以把页面分割成不同的几块,同步方式获取数据。即分别调用 ...
相关推荐
基于SpringMVC 的图片上传功能,jsp页面+jquery+java后台齐全,如有疑问360513293,有下载完不知道如何使用的请联系
Spring MVC 注解模式下怎么样上传FTP图片,内容很简单,一看就会
使用Spring MVC进行上传下载 , 图片上传,多图片 同时上传
Spring MVC多图片上传,多值上传,完整项目,保证可以完整运行,开发环境netbeans
今天小编就为大家分享一篇layui 图片上传+表单提交+ Spring MVC的实例,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
springMVC+uploadify上传图片。
例子为MVC项目。通过uploadify控件实现了 多张图片上传,有缩略图提示。
Spring MVC 学习总结(五)——校验与文件上传 目录 2.2.7、范围 2.2.8、其它注解 2.3、注解控制器参数 1.4、在UI中添加错误标签 1.5、测试运行 三、使用jQuery扩展插件Validate实现前端校验 3.1、jQuery扩展插件...
spring mvc+hibernate完成图片上传操作,存储至blob字段。
spring mvc multipartResolver结合uploadify操作图片文件上传与预览
ckeditor整合Spring MVC实现富文本编辑器上传图片实例 项目描述 SpringMVC 实现Ckeditor富文本编辑器,上传图片 运行环境 jdk8+tomcat8+mysql+eclipse 项目技术(必填) spring+spring mvc
spring mvc 例子 有图片上传等功能
本篇文章主要介绍了spring mvc实现文件上传并携带其他参数的示例,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
版本管理,服务根路径工具类,文件上传工具类 1.0.10 集成ueditor在线编辑器 1.0.11 地址联动 1.0.12 Excel工具类 Word工具类 Java NIO实现socket工具类 分布式session jdk升级到1.7 嵌入式redis服务(只支持linux) ...
基于SpringBoot的文件上传系统,前后端分离,单文件上传,多文件上传,大文件上传,断点续传,文件秒传,图片上传 项目经过严格测试,确保可以运行! 采用前后端分离的方式进行开发,实现了几种常用的文件上传功能...
【源码】mysql版本_spring3.0 系统模块 1....服务器内部GET POST 请求 25.uploadify 上传插件,单条、批量上传,带进度条,异步,图片、视频, 其它文件格式均可上传 26.地图选点获取经纬度坐标,根据俩经纬度计算距离
看见大多帖子都描述了关于Spring MVC模式下的文件批量上传代码,我在此整理后,分享给大家
SpringMVC文件上传Demo代码
spring boot 图片上传并显示的小demo spring boot 的文件上传与 spring mvc 的文件上传基本一致,只需注意一些配置即可。
该毕业设计使用了spring mvc,spring,mybatis的框架组合,本网站相当于一个平台,有效的将房东和背包客关联起来,房东可以在网站中发布房源,对房源图片可以进行上传展示,有利于吸引客户,背包客可以挑选自己中意...