| 发表于:2007-03-04 23:34:111楼 得分:0 |
jsp2.jsp(跳转页) <%@ page contenttype= "text/html; charset=gbk " import= "java.util.* " %> <%@ page language= "java " import= "com.jspsmart.upload.* "%> <jsp:usebean id= "mysmartupload " scope= "page " class= "com.jspsmart.upload.smartupload " /> <html> <head> <title> jsp2 </title> </head> <body bgcolor= "#ffffff "> <% string id = request.getparameter( "id "); try { string str = " "; mysmartupload.initialize(pagecontext); mysmartupload.upload(); string file1=mysmartupload.getrequest().getparameter( "file1 "); string file2=mysmartupload.getrequest().getparameter( "file2 "); string file3=mysmartupload.getrequest().getparameter( "file3 "); //有问题!如果输入并且正确的话 if(mysmartupload.getfiles().getcount()> 0) { com.jspsmart.upload.file myfile = mysmartupload.getfiles().getfile(0); date date=new date(); str =date.gettime()+ myfile.getfilename(); myfile.saveas( "/upload/ " + str); } else { out.println( "你没有选择要上传的 "); } request.setattribute( "111 ",file1); request.setattribute( "222 ",file2); request.setattribute( "333 ",file3); request.setattribute( "444 ",str); request.setattribute( "555 ",id); request.getrequestdispatcher( "servlet1 ").forward(request,response); } catch(exception e) { //out.println( "上传失败 请认真检查文件是否存在 "); response.sendredirect( "error.jsp "); } %> </body> </html> | | |
|