打错字了,最后一行应该是输出都是null,得不到传过去的值.
解决方案 »
- 请教关于servlet后缀的问题
- 关于hibernate的Configuration类的加载
- session是不是只要把当前见面关了就无效了呢?
- JSP 连接SQL SERVER 2000数据库 例程
- 新浪UC聊天室的实现采用的是什么原理?可以在这种技术上添加远程协助功能吗?
- MySQL-Front的问题
- jsp+mysql插入数据库乱码解决方法!!!!绝对有用,分享!!!
- 为什么我新下的jcreator pro 3.0 设置不了jdk路径?
- 在filterchain中如果没有filter了,就调用一个 the rosource at the end of the chain??
- 求指点:PC端与移动app端做数据同步需要完成哪些后台的操作?不胜感激
- 在java中如何判断一个字符串符合日期格式是否正确)?比如1999/02/31 返回FALSE。像VB的IsDate一样。非常感谢。
- 请问:怎样让weblogic处于开发模式,也就是,我的bean等类更改了,不必要重起weblogic。多谢
mySmartUpload.getRequest().getParameter("subfolder");
<%@ page import = "EPG.Excel.*"%>
<%@ page import = "EPG.*"%>
<%@ page import = "java.util.*"%>
<%@ page import = "java.io.*"%>
<%@ page import = "org.jdom.*"%>
<%@ page import = "org.jdom.input.*"%>
<%@ page errorPage = "epgerrorpage.jsp"%>
<%@ include file="epgsetting.jsp"%>
<%@ include file="PIDGMenu.html"%>
<%
//Change test mode or running mode by epgsetting.jsp
String isShow = "";
if(isTest)
{
}
else
{
isShow = "style=\"visibility:hidden\"";
}
%><HTML>
<HEAD>
<TITLE> Upload Excel Program </TITLE>
<link rel="stylesheet" href="../Css/epg.css">
</HEAD><%
//Set the total number of upload files
int def_filenumber = 5;
String filenumber = request.getParameter("filenumber"); if( (filenumber != null) && (filenumber.length() > 0 ) && (paytvutil.isNumber(filenumber)))
{
try{
def_filenumber = Integer.parseInt(filenumber);
}catch(NumberFormatException e)
{
out.println("Invalid 'Total number of uploading files' ");
return;
}
}
//Get the root folder of excel file
String rootpath = ExcelSetting.getPropertise("UPLOADPATH");
//Get all the sub folder of the excel root folder
Vector vfolder = paytv.paytvutil.getFolderNames(rootpath);
//Get the selected subfolder name
String def_subfolder = "";
String subfolder = request.getParameter("subfolder");
if( (subfolder != null) && (subfolder.length() > 0) )
def_subfolder = subfolder;
else if(vfolder.size() != 0)
{
def_subfolder = (String)vfolder.elementAt(0);
} String subfolderpath = rootpath + File.separator + def_subfolder;
//Replace '\' for javascript
subfolderpath = paytv.paytvutil.replaceAll(subfolderpath,"\\","\\\\");
rootpath = paytv.paytvutil.replaceAll(rootpath,"\\","\\\\");/*
String subfoldername = request.getParameter("subfoldername");
if( (subfoldername == null) || (subfoldername.length() <= 0) )
{
throw new NullPointerException("Image folder can not be null");
}
*/
%>
<script>function uploadImage()
{
document.formUpload.submit();
}
//Change the subfolder as selected folder name after page load
function changeLB()
{
var rootpath = "<%=rootpath%>";
for(i=0;i<document.formUploadSetting.subfolder.options.length;i++)
{
if(document.formUploadSetting.subfolder.options[i].value == '<%=def_subfolder%>')
{
document.formUploadSetting.subfolder.options[i].selected = true;
document.formUpload.subfolder.value = '<%=subfolderpath%>';
break;
}
}
}//Change the upload form when the subfolder selected
function changeSubfolder()
{
var rootpath = "<%=rootpath%>";
document.formUpload.subfolder.value = "<%=rootpath%>/" + document.formUploadSetting.subfolder.value;
}
</script>
<BODY onload="changeLB()"><div align="center"><font color="red">Upload excel file</font></div>
<form name="formUploadSetting" method="post" action="excelupload.jsp">
<table>
<tr>
<td>
Total number of uploading images:
</td>
<td valign="center">
<input type="text" class="box" name="filenumber" value="<%=def_filenumber%>">
Folder Name:
<select name="subfolder" onchange="changeSubfolder()">
<%
for(int i=0;i<vfolder.size();i++)
{
String foldername = (String)vfolder.elementAt(i);
%>
<option value="<%=foldername%>">
<%=foldername%>
</option>
<%
}//end for
%>
</select>
</td>
</tr>
</table>
</form>
<FORM name="formUpload" METHOD="POST" ACTION="uploadaction.jsp" ENCTYPE="multipart/form-data">
<input name="subfolder" value="<%=def_subfolder%>" <%=isShow%> size="50">
<input name="fileformat" value="xls" size="50" <%=isShow%> >
<%
for(int i=0;i<def_filenumber;i++)
{
%>
<p><INPUT class="box" TYPE="FILE" NAME="FILE<%=i%>" SIZE="50">
<%
}
%>
<p>
<INPUT class="box" TYPE="button" name="uploadbuttohn" VALUE="Upload" onclick="uploadImage()">
</FORM></BODY>
</HTML>
<jsp:useBean id="mySmartUpload" scope="page" class="com.jspsmart.upload.SmartUpload" />
<link rel="stylesheet" href="../Css/epg.css">
<%@ page errorPage = "epgerrorpage.jsp"%>
<%@ include file="epgsetting.jsp"%>
<HTML>
<BODY><H1>Upload Image Response</H1><%
// Variables
int count=0; // Initialization
mySmartUpload.initialize(pageContext); //Get the file format
String fileformat = "xls";
//mySmartUpload.getRequest().getParameter("fileformat");
/*
if( (fileformat == null ) || (fileformat.length() == 0 ) )
{
fileformat = ",,";
}
else
{
//fileformat = fileformat + ",xls,txt";
}*/
mySmartUpload.setAllowedFilesList(fileformat);
mySmartUpload.setDeniedFilesList("bat,exe,com,jsp,sh"); // Upload
mySmartUpload.upload();
String subfolder = mySmartUpload.getRequest().getParameter("subfolder");
if( (subfolder == null) || (subfolder.length() <= 0) )
{
throw new NullPointerException("Folder can not be null");
}
// Select each file
for (int i=0;i<mySmartUpload.getFiles().getCount();i++){ // Retreive the current file
com.jspsmart.upload.File myFile = mySmartUpload.getFiles().getFile(i); // Save it only if this file exists
if (!myFile.isMissing()) { // Save the files with its original names in a virtual path of the web server
//myFile.saveAs("/upload/" + myFile.getFileName());
out.println("<p>");
//Check the file exist or not
java.io.File f = new java.io.File(subfolder + java.io.File.separator + myFile.getFileName());
if( ( f.isFile() ) && ( f.exists() ) )
{
out.println("<font color='red'>" + myFile.getFileName() + " has been overriden.</font><BR>");
}
myFile.saveAs(subfolder + java.io.File.separator + myFile.getFileName());
//out.println(subfolder + java.io.File.separator + myFile.getFileName());
// myFile.saveAs("/upload/" + myFile.getFileName(), mySmartUpload.SAVE_VIRTUAL); // sample with a physical path
// myFile.saveAs("c:\\temp\\" + myFile.getFileName(), mySmartUpload.SAVE_PHYSICAL); // Display the properties of the current file
out.println("FieldName = " + myFile.getFieldName() + "<BR>");
out.println("Size = " + myFile.getSize() + "<BR>");
out.println("FileName = " + myFile.getFileName() + "<BR>");
out.println("FileExt = " + myFile.getFileExt() + "<BR>");
out.println("FilePathName = " + myFile.getFilePathName() + "<BR>");
out.println("ContentType = " + myFile.getContentType() + "<BR>");
out.println("ContentDisp = " + myFile.getContentDisp() + "<BR>");
out.println("TypeMIME = " + myFile.getTypeMIME() + "<BR>");
out.println("SubTypeMIME = " + myFile.getSubTypeMIME() + "<BR>"); count ++; } } // Display the number of files which could be uploaded
out.println("<BR>" + mySmartUpload.getFiles().getCount() + " files could be uploaded.<BR>"); // Display the number of files uploaded
out.println(count + " file(s) uploaded.");
%>
<p>
<input class="box" type="button" name="backButton" value="Back to file List" onclick="document.location.href='excellist.jsp'">
<input class="box" type="button" name="uploadButton" value="Continue to upload file" onclick="document.location.href='excelupload.jsp'">
</BODY>
</HTML>
It aslo contains an example what u want.