当前位置: 技术问答>java相关
谁用过jspsmart文件上传的??进来指点2招!!!急等!!
来源: 互联网 发布时间:2015-04-15
本文导语: 调用mySmartUpload的servlet怎么得到form的参数???? 如下: String filedescribe=mySmartUpload.getRequest().getParameter("fileDescrible"); 返回为null?? | // Initialization myUpload.initialize(pageContext); // Upload myUpload.upload...
调用mySmartUpload的servlet怎么得到form的参数????
如下:
String filedescribe=mySmartUpload.getRequest().getParameter("fileDescrible");
返回为null??
如下:
String filedescribe=mySmartUpload.getRequest().getParameter("fileDescrible");
返回为null??
|
// Initialization
myUpload.initialize(pageContext);
// Upload
myUpload.upload();
// Retreive Requests' names
java.util.Enumeration e = myUpload.getRequest().getParameterNames();
// Retreive parameters
while (e.hasMoreElements()) {
String key = (String)e.nextElement();
String[] values = myUpload.getRequest().getParameterValues(key);
key=key.trim();
// Browse the current parameter values
if(values.length>0)
{
if("sessionid".equals(key))
sessionid=values[0];
else if("Title".equals(key)){
Title=values[0];
Title=new String(Title.getBytes("GBK"),"ISO-8859-1");}
else if("Content".equals(key)){
Content=values[0];
Content=new String(Content.getBytes("GBK"),"ISO-8859-1");}
else if("AbateTime".equals(key))
AbateTime=values[0];
else if("ReceiveNodeID".equals(key))
ReceiveNodeID=values[0];
else if("Receiver".equals(key))
Receiver=values[0];
else if("act".equals(key))
act=values[0];
else if("Field1".equals(key))
MessageID=values[0];
else if("ParentMessageID".equals(key))
ParentMessageID=values[0];
}
}
myUpload.initialize(pageContext);
// Upload
myUpload.upload();
// Retreive Requests' names
java.util.Enumeration e = myUpload.getRequest().getParameterNames();
// Retreive parameters
while (e.hasMoreElements()) {
String key = (String)e.nextElement();
String[] values = myUpload.getRequest().getParameterValues(key);
key=key.trim();
// Browse the current parameter values
if(values.length>0)
{
if("sessionid".equals(key))
sessionid=values[0];
else if("Title".equals(key)){
Title=values[0];
Title=new String(Title.getBytes("GBK"),"ISO-8859-1");}
else if("Content".equals(key)){
Content=values[0];
Content=new String(Content.getBytes("GBK"),"ISO-8859-1");}
else if("AbateTime".equals(key))
AbateTime=values[0];
else if("ReceiveNodeID".equals(key))
ReceiveNodeID=values[0];
else if("Receiver".equals(key))
Receiver=values[0];
else if("act".equals(key))
act=values[0];
else if("Field1".equals(key))
MessageID=values[0];
else if("ParentMessageID".equals(key))
ParentMessageID=values[0];
}
}
|
你可以看看他的例子,
Init the servlet完成了吗?
Init the servlet完成了吗?