比如jsp页面图片选择为<input name="url" class="input-large" type="file"></input>,提交之后,后台如何将图片用时间戳命名,并写到服务器的指定文件夹。
@RequestMapping(value = "gift/addGift.do")
@ResponseBody
public Map<String,Object> addGift(HttpServletRequest req,
HttpServletResponse resp) {
代码
}
ååè¡æ¯éè¦å»ºç«å®ä½ç±»åï¼è¿æå°±æ¯æ交çä¸çurlå¨actionä¸æä¹è·åï¼
ãã
é£ä¸ä¸ªåéå°±æ¯actionä¸çåéï¼è®°å¾è¦è®¾ç½®get setæ¹æ³
struts2 ä¼èªå¨å°é£äºåéåå§å
ä¸é¢çè¾å
¥è¾åºæµå¯ä»¥æ¾å°executeï¼ï¼ä¸
ä¸ä¼ ä¸äºé件 ä¸ç¶å¯ä»¥ç´æ¥ç»ä½ çæ以ååç代ç
è¿æstruts.xml éactionçé
ç½® åèå¦ä¸
/user/success.jsp
/user/showphoto.jsp
/error.jsp
image/bmp,image/pjpeg,image/gif,image/png,image/jpeg
1024*1024
æç¨çåªæ¯spring+mybatis
追çè¿ä¸ªè¿ç没ç¨è¿
å¯ä»¥çä¸è¿ä¸ªï¼
http://www.cnblogs.com/wuyifu/p/3627516.html