有错误!!!org.apache.jasper.JasperException: Unable to compile class for JSPAn error occurred at line: 1 in the jsp file: /jsp/sample1.jspGenerated servlet error: [javac] Compiling 1 source fileC:\tomcat4\work\Standalone\localhost\jspsmartupload\jsp\sample1_jsp.java:7: package com.jspsmart.upload does not exist import com.jspsmart.upload.*; ^ C:\tomcat4\work\Standalone\localhost\jspsmartupload\jsp\sample1_jsp.java:43: package com.jspsmart.upload does not exist com.jspsmart.upload.SmartUpload mySmartUpload = null; ^An error occurred at line: 1 in the jsp file: /jsp/sample1.jspGenerated servlet error: C:\tomcat4\work\Standalone\localhost\jspsmartupload\jsp\sample1_jsp.java:45: package com.jspsmart.upload does not exist mySmartUpload = (com.jspsmart.upload.SmartUpload) pageContext.getAttribute("mySmartUpload", PageContext.PAGE_SCOPE); ^An error occurred at line: 1 in the jsp file: /jsp/sample1.jspGenerated servlet error: C:\tomcat4\work\Standalone\localhost\jspsmartupload\jsp\sample1_jsp.java:48: package com.jspsmart.upload does not exist mySmartUpload = (com.jspsmart.upload.SmartUpload) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "com.jspsmart.upload.SmartUpload"); ^ 4 errors
我也下了jspsmartupload,他是一个文件夹,要怎么配制呀??谢谢!
<jsp:useBean id="mySmartUpload" scope="page" class="com.jspsmart.upload.SmartUpload" />
<%@ page language="java" import="com.jspsmart.upload.*"%>
<%@ page import="java.io.*" %>
<HTML>
<LINK
href="css.txt" rel=stylesheet type=text/css>
<BODY background="img/back.gif">
<%
//文件夹已有文件大小
int totlesize=Integer.parseInt((String)session.getAttribute("totlesize"));
//初始化
mySmartUpload.initialize(pageContext);
mySmartUpload.setTotalMaxFileSize(50*1000*1000-totlesize);
mySmartUpload.upload();
//得到个人文件夹管理总根目录
String requesturl=request.getRequestURI();
String contextpath=request.getContextPath();
String relativePath = requesturl.substring(contextpath.length());
String filepath= getServletConfig().getServletContext().getRealPath(relativePath);
String rootpath=filepath.substring(0,filepath.lastIndexOf(java.io.File.separator));
rootpath=rootpath+java.io.File.separator+"userfold"+java.io.File.separator;
//当前工作路径
String savepath=rootpath+mySmartUpload.getRequest().getParameter("fold");com.jspsmart.upload.File myFile = mySmartUpload.getFiles().getFile(0);
%>
<TABLE border="0" align="center">
<TR>
<TD><TABLE width="200" border="0">
<TR>
<TD><%if (!myFile.isMissing()){
//取得上载的文件的文件名
String myFileName=myFile.getFileName();
//将文件保存在服务器端
try{
myFile.saveAs(savepath+myFileName,mySmartUpload.SAVE_PHYSICAL);
out.print("<DIV align=\"center\">文件已上传至服务器</DIV>");
out.print("<hr>");
out.print("<nobr>文件名:</nobr><br>");
out.print("<nobr>"+mySmartUpload.getFiles().getFile(0).getFileName()+"</nobr>");
long size=mySmartUpload.getFiles().getFile(0).getSize();
String aaaa="";
session.setAttribute("totlesize",aaaa.valueOf(totlesize+size));
}catch(Exception e){
out.print("上传文件大小超过容量限制");
}
}else{
out.print("文件上传失败");
}
%>
</TD>
</TR>
</TABLE></TD>
</TR>
<TR>
<TD> </TD>
</TR>
<TR>
<TD><DIV align="center"><A href="#" onClick="closewin()">关闭</A> </DIV></TD>
</TR>
</TABLE>
</BODY>
</HTML>
要是用 jspsmartupload 的化!怎么配制?我是初学者,请尽量详细一些!
越通俗越好!!谢谢大家了!
如果你不能够用代码连接数据库,我看你就先别看上传了。
如果你能够连接数据库,我看,你也别嚷嚷,静心的将JSPSMARTUPLOAD中的例子过一遍,你就会上传了。
我就是不知道,怎么配置这个组件!JSPSMARTUPLOAD中的例子运行出错!
把它的Web-inf/class子目录复制到你的web app 的 root/WEB-INF/下,
然后照着它的例子写就可以了。它自己的出错是因为目录名没有大写吧?
一定要是WEB-INF,大写。别的还有什么问题?
[javac] Compiling 1 source fileC:\tomcat4\work\Standalone\localhost\jspsmartupload\jsp\sample1_jsp.java:7: package com.jspsmart.upload does not exist
import com.jspsmart.upload.*;
^
C:\tomcat4\work\Standalone\localhost\jspsmartupload\jsp\sample1_jsp.java:43: package com.jspsmart.upload does not exist
com.jspsmart.upload.SmartUpload mySmartUpload = null;
^An error occurred at line: 1 in the jsp file: /jsp/sample1.jspGenerated servlet error:
C:\tomcat4\work\Standalone\localhost\jspsmartupload\jsp\sample1_jsp.java:45: package com.jspsmart.upload does not exist
mySmartUpload = (com.jspsmart.upload.SmartUpload) pageContext.getAttribute("mySmartUpload", PageContext.PAGE_SCOPE);
^An error occurred at line: 1 in the jsp file: /jsp/sample1.jspGenerated servlet error:
C:\tomcat4\work\Standalone\localhost\jspsmartupload\jsp\sample1_jsp.java:48: package com.jspsmart.upload does not exist
mySmartUpload = (com.jspsmart.upload.SmartUpload) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "com.jspsmart.upload.SmartUpload");
^
4 errors