public ActionForward add(ActionMapping mapping ActionForm form
HttpServletRequest request HttpServletResponse response) {
TruckBaseForm tbf = (TruckBaseForm)form;
FormFile filename = tbfgetFilename();
String tempname = ;
if ( filenamegetFileName()trim()length() > ){
// 取得上传时间
Date dt = new Date() ;
long updatetime=dtgetTime();
try{
//开始上传文件
String filePath = thisgetServlet()getServletContext()getRealPath(/) ; //取得当前路径
InputStream stream = filenamegetInputStream() ; //把文件读入
// ByteArrayOutputStream baos = new ByteArrayOutputStream() ;
int position = filenamegetFileName()indexOf() ;
String type = filenamegetFileName()substring(position);
tempname =updatetime+type ;
OutputStream bos = new FileOutputStream(filePath + truckimg\\ + tempname ) ;
//requestsetAttribute(fileNamefilePath + / + CharFiltertoChinese((String)filenamegetFileName()) ) ;
int bytesRead = ;
byte[] buffer = new byte[] ;
while( (bytesRead = streamread(buffer) ) != ){
boswrite(bufferbytesRead) ;
}
bosclose();
streamclose() ;
//上传文件完成
}
catch(Exception e){
efillInStackTrace();
}
}
TruckBase tb = thismakeTruckBase(tbftempname);
//tbSEVdeleteTruckBase(tb);
int truckid = IntegerparseInt(+requestgetParameter(truckid));
//保存后返回的int是主键的ID记录过的(包括删除过的id的个数)
int result = thistbSEVsaveTruckBase(tb);
List list = new ArrayList();
//保存后再捞一遍数据
list = tbSEVgetAllTruckBase(truckid);
requestsetAttribute(truckbaseListlist);
list = (ArrayList)dataSEVgetDataDictionaryList();
requestsetAttribute(dataListlist);
TruckCard td = new TruckCard();
td = thistcSEVgetTruckCard(truckid);
requestsetAttribute(truckCardList td);
return mappingfindForward(add);
}