大神帮忙解释一下这段代码……
StringtimeTemp=String.valueOf(newDate().getTime());DiskFileItemFactoryfactory=newDisk...
String timeTemp = String.valueOf(new Date().getTime());
DiskFileItemFactory factory = new DiskFileItemFactory();
factory.setSizeThreshold(2048 * 1024);
UploadProgressListener getBarListener = new UploadProgressListener(
request);
ServletFileUpload upload = new ServletFileUpload(factory);
upload.setProgressListener(getBarListener);
List formList = upload.parseRequest(request);
Iterator<Object> formItem = formList.iterator();
while (formItem.hasNext()) {
FileItem item = (FileItem) formItem.next();
if (!item.isFormField()) {
}else{
String fieldName = item.getFieldName();
if (fieldName.equals("user")) {
input_user = item.getString("UTF-8");
}
if (fieldName.equals("password")) {
input_passw = item.getString("UTF-8");
}
if (fieldName.equals("isselect")) {
select_ts = item.getString("UTF-8");
}
}
HttpSession session = request.getSession(); 展开
DiskFileItemFactory factory = new DiskFileItemFactory();
factory.setSizeThreshold(2048 * 1024);
UploadProgressListener getBarListener = new UploadProgressListener(
request);
ServletFileUpload upload = new ServletFileUpload(factory);
upload.setProgressListener(getBarListener);
List formList = upload.parseRequest(request);
Iterator<Object> formItem = formList.iterator();
while (formItem.hasNext()) {
FileItem item = (FileItem) formItem.next();
if (!item.isFormField()) {
}else{
String fieldName = item.getFieldName();
if (fieldName.equals("user")) {
input_user = item.getString("UTF-8");
}
if (fieldName.equals("password")) {
input_passw = item.getString("UTF-8");
}
if (fieldName.equals("isselect")) {
select_ts = item.getString("UTF-8");
}
}
HttpSession session = request.getSession(); 展开
展开全部
//定义timeTemp为当前时间距离1970 年1 月1 日0点的毫秒数
String timeTemp = String.valueOf(new Date().getTime());
//new一个DiskFileItemFactory类型的对象factory(文件工厂)
DiskFileItemFactory factory = new DiskFileItemFactory();
//为factory设置是否将上传文件已临时文件的形式保存在磁盘的临界值
//(以字节为单位的int值)
factory.setSizeThreshold(2048 * 1024);
//文件上传监听器
UploadProgressListener getBarListener = new UploadProgressListener
(request);
//new一个ServletFileUpload类型的对象upload
ServletFileUpload upload = new ServletFileUpload(factory);
//监听upload
upload.setProgressListener(getBarListener);
//请求体中获取参数赋值到formList
List formList = upload.parseRequest(request);
//建立迭代器formItem
Iterator<Object> formItem = formList.iterator();
//当formItem序列中还有元素时
while (formItem.hasNext()) {
//建立一个FileItem类的对象item
FileItem item = (FileItem) formItem.next();
//判断item封装的数据是一个普通文本表单字段,
//还是一个文件上传表单字段,
//如果是普通表单字段则返回true,否则返回false
//此处为文件上传表单字段不做任何操作
if (!item.isFormField()) {
}else{//普通文本表单字段
//定义fieldName用于返回表单标签name属性的值
String fieldName = item.getFieldName();
if (fieldName.equals("user")) {//值为user
//input_user=item的UTF-8格式
input_user = item.getString("UTF-8");
}
if (fieldName.equals("password")) {//值为password
//input_passw=item的UTF-8格式
input_passw = item.getString("UTF-8");
}
if (fieldName.equals("isselect")) {//值为isselect
//select_ts=item的UTF-8格式
select_ts = item.getString("UTF-8");
}
}
//定义HttpSession类session用于传送数据到jsp
HttpSession session = request.getSession();
AiPPT
2024-09-19 广告
2024-09-19 广告
随着AI技术的飞速发展,如今市面上涌现了许多实用易操作的AI生成工具1、简介:AiPPT: 这款AI工具智能理解用户输入的主题,提供“AI智能生成”和“导入本地大纲”的选项,生成的PPT内容丰富多样,可自由编辑和添加元素,图表类型包括柱状图...
点击进入详情页
本回答由AiPPT提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询