資源簡介
1 此系統(tǒng)采用了目前最流行的ssm框架,其中的spingMVC框架相對于struts2框架更靈活,更安全。
2 本項(xiàng)目springMVC框架采用了注解映射器,使用了RESTful風(fēng)格的url對系統(tǒng)發(fā)起http請求,開發(fā)更靈活。
3 同時使用了了hibernate提供的校驗(yàn)框架,對客戶端數(shù)據(jù)進(jìn)行校驗(yàn)!
4 Mybati數(shù)據(jù)庫DAO層采用的是Mapper代理開發(fā)方法,輸入映射采用的是POJO包裝類型實(shí)現(xiàn),輸出映射采用了resultMap類型,實(shí)現(xiàn)了數(shù)據(jù)庫多對一映射。
5 spring容器內(nèi)部使用攔截器,以Spring AOP的方式實(shí)現(xiàn)事務(wù)控制管理。
代碼片段和文件信息
package?com.shuangyulin.controller;
import?java.beans.PropertyEditorSupport;
import?java.io.File;
import?java.io.IOException;
import?java.text.SimpleDateFormat;
import?java.util.Date;
import?java.util.UUID;
import?javax.servlet.http.HttpServletRequest;
import?org.springframework.beans.propertyeditors.CustomDateEditor;
import?org.springframework.web.bind.WebDataBinder;
import?org.springframework.web.bind.annotation.InitBinder;
import?org.springframework.web.multipart.MultipartFile;
import?org.springframework.web.multipart.MultipartHttpServletRequest;
import?com.shuangyulin.utils.UserException;
public?class?baseController?{
@InitBinder
//?必須有一個參數(shù)WebDataBinder
public?void?initBinder(WebDataBinder?binder)?{
//System.out.println(binder.getFieldDefaultPrefix());
binder.registerCustomEditor(Date.class?new?CustomDateEditor(
new?SimpleDateFormat(“yyyy-MM-dd“)?false));
?
binder.registerCustomEditor(Integer.class?new?PropertyEditorSupport()?{
@Override
public?String?getAsText()?{?
return?(getValue()?==?null)???““?:?getValue().toString();
}?
@Override
public?void?setAsText(String?text)?{
Integer?value?=?null;
if?(null?!=?text?&&?!text.equals(““))?{??
try?{
value?=?Integer.valueOf(text);
}?catch(Exception?ex)??{?
throw?new?UserException(“數(shù)據(jù)格式輸入不正確!“);?
}??
}
setValue(value);
}?
});
??
//binder.registerCustomEditor(Integer.class?nullnew?CustomNumberEditor(Integer.class?null?true));
binder.registerCustomEditor(Float.class?new?PropertyEditorSupport()?{
@Override
public?String?getAsText()?{?
return?(getValue()?==?null)??““?:?getValue().toString();
}?
@Override
public?void?setAsText(String?text)??{
Float?value?=?null;
if?(null?!=?text?&&?!text.equals(““))?{
try?{
value?=?Float.valueOf(text);
}?catch?(Exception?e)?{?
throw?new?UserException(“數(shù)據(jù)格式輸入不正確!“);?
}
}
setValue(value);
}
});
}
?
/**?
?*?處理圖片文件上傳,返回保存的文件名路徑
?*?fileKeyName:?圖片上傳表單key
?*?@throws?IOException?
?*?@throws?IllegalStateException?
?*/?
public?String?handlePhotoFileUpload(HttpServletRequest?requestString?fileKeyName)?throws?IllegalStateException?IOException?{
String?fileName?=?“upload/NoImage.jpg“;
MultipartHttpServletRequest?multipartRequest?=?(MultipartHttpServletRequest)?request;?
????????/**構(gòu)建圖片保存的目錄**/????
????????String?photoBookPathDir?=?“/upload“;?????
????????/**得到圖片保存目錄的真實(shí)路徑**/????
????????String?photoBookRealPathDir?=?request.getSession().getServletContext().getRealPath(photoBookPathDir);?????
????????/**根據(jù)真實(shí)路徑創(chuàng)建目錄**/????
????????File?photoBookSaveFile?=?new?File(photoBookRealPathDir);?????
????????if(!photoBookSaveFile.exists())?????
???????? photoBookSaveFile.mkdirs();???????????
????????/**頁面控件的文件流**/????
????????MultipartFile?multipartFile_photoBook?=?multipartRequest.getFile(fileKeyName);????
????????if(!m
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-07-31?17:07??雙魚林SSM圖書信息管理系統(tǒng)\
?????文件????????3627??2017-07-30?16:00??雙魚林SSM圖書信息管理系統(tǒng)\.classpath
?????目錄???????????0??2017-07-30?17:10??雙魚林SSM圖書信息管理系統(tǒng)\.myeclipse\
?????文件?????????315??2017-07-30?14:58??雙魚林SSM圖書信息管理系統(tǒng)\.myme
?????文件????????1420??2017-07-31?02:05??雙魚林SSM圖書信息管理系統(tǒng)\.project
?????目錄???????????0??2017-07-31?02:38??雙魚林SSM圖書信息管理系統(tǒng)\.settings\
?????文件?????????500??2017-07-30?23:23??雙魚林SSM圖書信息管理系統(tǒng)\.settings\.jsdtscope
?????文件?????????104??2017-07-30?11:57??雙魚林SSM圖書信息管理系統(tǒng)\.settings\com.genuitec.eclipse.core.prefs
?????文件?????????197??2017-07-30?11:59??雙魚林SSM圖書信息管理系統(tǒng)\.settings\org.eclipse.core.resources.prefs
?????文件?????????330??2017-07-30?17:53??雙魚林SSM圖書信息管理系統(tǒng)\.settings\org.eclipse.jdt.core.prefs
?????文件??????????49??2017-07-30?10:55??雙魚林SSM圖書信息管理系統(tǒng)\.settings\org.eclipse.wst.jsdt.ui.superType.container
?????文件???????????6??2017-07-31?06:59??雙魚林SSM圖書信息管理系統(tǒng)\.settings\org.eclipse.wst.jsdt.ui.superType.name
?????目錄???????????0??2017-07-30?17:33??雙魚林SSM圖書信息管理系統(tǒng)\config\
?????文件?????????319??2017-07-30?20:49??雙魚林SSM圖書信息管理系統(tǒng)\config\jdbc.properties
?????文件?????????329??2017-07-30?15:04??雙魚林SSM圖書信息管理系統(tǒng)\config\log4j.properties
?????目錄???????????0??2017-07-31?04:39??雙魚林SSM圖書信息管理系統(tǒng)\config\mybatis\
?????文件?????????648??2017-07-31?03:31??雙魚林SSM圖書信息管理系統(tǒng)\config\mybatis\sqlMapConfig.xm
?????目錄???????????0??2017-07-30?21:34??雙魚林SSM圖書信息管理系統(tǒng)\config\spring\
?????文件????????2443??2017-07-30?16:46??雙魚林SSM圖書信息管理系統(tǒng)\config\spring\applicationContext-dao.xm
?????文件????????1317??2017-07-30?10:36??雙魚林SSM圖書信息管理系統(tǒng)\config\spring\applicationContext-service.xm
?????文件????????2370??2017-07-31?16:31??雙魚林SSM圖書信息管理系統(tǒng)\config\spring\applicationContext-transaction.xm
?????文件????????3054??2017-07-30?19:22??雙魚林SSM圖書信息管理系統(tǒng)\config\spring\springmvc.xm
?????目錄???????????0??2017-07-30?11:17??雙魚林SSM圖書信息管理系統(tǒng)\mysql數(shù)據(jù)庫腳本\
?????文件????????3110??2017-07-30?08:30??雙魚林SSM圖書信息管理系統(tǒng)\mysql數(shù)據(jù)庫腳本\book_db.sql
?????目錄???????????0??2017-07-30?16:48??雙魚林SSM圖書信息管理系統(tǒng)\src\
?????目錄???????????0??2017-07-30?23:29??雙魚林SSM圖書信息管理系統(tǒng)\src\com\
?????目錄???????????0??2017-07-31?07:10??雙魚林SSM圖書信息管理系統(tǒng)\src\com\shuangyulin\
?????目錄???????????0??2017-07-30?14:07??雙魚林SSM圖書信息管理系統(tǒng)\src\com\shuangyulin\controller\
?????文件????????4007??2017-07-31?05:00??雙魚林SSM圖書信息管理系統(tǒng)\src\com\shuangyulin\controller\ba
?????文件???????10637??2017-07-31?03:52??雙魚林SSM圖書信息管理系統(tǒng)\src\com\shuangyulin\controller\BookController.java
?????文件????????6446??2017-07-30?08:53??雙魚林SSM圖書信息管理系統(tǒng)\src\com\shuangyulin\controller\BookTypeController.java
............此處省略242個文件信息
評論
共有 條評論