Home > Back-end >  Bosses information management system after adding information error anxious for help have a look at
Bosses information management system after adding information error anxious for help have a look at

Time:12-17





Code:


Private void addProject (it request, HttpServletResponse response) throws ServletException, IOException {
The final long MAX_SIZE=2048 * 1024 * 1024;//sets the maximum upload files as 2 g, can change to a bigger
//form contains file to submit
String path=request. GetContextPath ();
DiskFileItemFactory DiskFileItemFactory=new DiskFileItemFactory ();
//build a file upload class
ServletFileUpload ServletFileUpload=new ServletFileUpload (diskFileItemFactory);
//servletFileUpload setFileSizeMax (3 * 1024 * 1024);
ServletFileUpload. SetSizeMax (MAX_SIZE);//upload file total size
List list=null;
List Params=new ArrayList (a);

String startTime="";
String endTime="";

String imgPaths="";

Try {
//request parse request
List=servletFileUpload. ParseRequest (request);
//remove all form values: determine the text field and text field
For (FileItem FileItem: list) {
If (fileItem isFormField ()) {

If (fileItem. GetFieldName (.) the equals (" personName ")) {
Params. Add (fileItem. Get string (" utf-8 "));
System. The out. Println (fileItem. Get string (" utf-8 "));
}

If (fileItem. GetFieldName (.) the equals (" personAge ")) {
Params. Add (fileItem. Get string (" utf-8 "));
System. The out. Println (fileItem. Get string (" utf-8 "));
}

If (fileItem. GetFieldName (.) the equals (" personPlace ")) {
Params. Add (fileItem. Get string (" utf-8 "));
System. The out. Println (fileItem. Get string (" utf-8 "));
}

If (fileItem. GetFieldName (.) the equals (" personEntrance ")) {
Params. Add (fileItem. Get string (" utf-8 "));
System. The out. Println (fileItem. Get string (" utf-8 "));
}

If (fileItem. GetFieldName (.) the equals (" personAddress ")) {
Params. Add (fileItem. Get string (" utf-8 "));
System. The out. Println (fileItem. Get string (" utf-8 "));

}
If (fileItem. GetFieldName (.) the equals (" personCard ")) {
Params. Add (fileItem. Get string (" utf-8 "));
System. The out. Println (fileItem. Get string (" utf-8 "));

}
} else {
Try {

String image=fileItem. GetName ();
String imageload=PingYinUtil. GetPingYin (image);
//params. Add (imageload);
String upload_path=request. GetRealPath ("/upload ");
System. Out.println (" -- -- -- & gt; & gt;" + upload_path);
String imgPath=Consts. ImgPath;
The File real_path=new File (+ imageload imgPath + "/");
FileItem. Write (real_path);

ImgPaths=imageload imgPaths + + ", ";

//the data inserted into the database
} the catch (Exception e) {
e.printStackTrace();
}

}
}
Params. Add (imgPaths. Substring (0, imgPaths. Length () - 1));

SimpleDateFormat df=new SimpleDateFormat (" yyyyMMddHHmmss ");//set the date format
String timeInfor=df. The format (new Date ());
Try {
String codefor=encode (timeInfor, "", Consts imgPath, true);
System. The out. Println (codefor);
Params. Add (codefor);
Params. Add (timeInfor);
} the catch (Exception e) {
//TODO Auto - generated the catch block,
e.printStackTrace();
}

A Boolean flag=softDao. AddProject (params);
System. The out. Println (flag);
If (flag) {

ListMessageProject (request, response);
} else {
System. Out. Println (flag: "no");
}

} the catch (FileUploadException e) {
//TODO Auto - generated the catch block,
e.printStackTrace();
}

}

CodePudding user response:

SOS SOS SOS SOS SOS
SOS SOS SOS SOS SOS

CodePudding user response:

See MessageAction. Java file of 1265 lines, a string to intercept the subscript crossing the line, first take a look at your output to intercept the length of the string is not what you want

CodePudding user response:

Which list cross-border
  • Related