java.lang.NoClassDefFoundError: com/jspsmart/upload/Files jsp问题求高手解答
我明明在web.xml当中申明了Picbiz这个servlet但是却在删除图片这个TD上面爆出来一个错误,它说:javax.servlet.ServletExceptio...
我明明在web.xml当中申明了Picbiz这个servlet但是却在删除图片这个TD上面爆出来一个错误,它说:
javax.servlet.ServletException: Error instantiating servlet class com.jsp.servlet.Picbiz
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
root causejava.lang.NoClassDefFoundError: com/jspsmart/upload/Files
java.lang.Class.getDeclaredConstructors0(Native Method)
java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
我这里
<servlet>
<servlet-name>Picbiz</servlet-name>
<servlet-class>com.jsp.servlet.Picbiz</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Picbiz</servlet-name>
<url-pattern>/Picbiz</url-pattern>
</servlet-mapping>
这个web.xml里面已经申明了而且
package com.jsp.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.jsp.bean.Admin;
import com.jsp.bean.Pic;
import com.jsp.bean.Picbean;
import com.jspsmart.upload.File;
import com.jspsmart.upload.Files;
public class Picbiz extends HttpServlet{
private String info="";
dopost里面略去,主要是
:
if (info.equals("userDeletePhoto")) {
this.user_deletePhoto(request, response);
}
然后又定义了一个方法
private void user_deletePhoto(HttpServletRequest request,
HttpServletResponse response) throws IOException, ServletException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
Integer id = Integer.valueOf(request.getParameter("id"));
Picbean picbean= new Picbean();
picbean.delete(id);
request.getRequestDispatcher("dealwith.jsp").forward(request, response);
}
private void forward_index(HttpServletRequest request,
HttpServletResponse response) {
}
然后页面的话plist1.jsp
<%
Connection conn = DataBaseConnection.getConnection();
String sql="select pname,author,pid from photo where ad=1";
PreparedStatement psmt= conn.prepareStatement(sql);
ResultSet rst= psmt.executeQuery();%>
<table>
</tr><% while(rst.next()){
String rst1=rst.getString(1);
String rst2=rst.getString(2);
int rst3=rst.getInt(3);
System.out.println("rst3 is "+rst3);
%>
<tr><td> 作者:<%=rst2%></td><td width="100"><a href="Picbiz?info=userDeletePhoto&id=rst3">删除此相片</a>
</td><td>图片:<img src=upload/<%=rst1%> width="200" height="220"></td> 展开
javax.servlet.ServletException: Error instantiating servlet class com.jsp.servlet.Picbiz
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
root causejava.lang.NoClassDefFoundError: com/jspsmart/upload/Files
java.lang.Class.getDeclaredConstructors0(Native Method)
java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
我这里
<servlet>
<servlet-name>Picbiz</servlet-name>
<servlet-class>com.jsp.servlet.Picbiz</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Picbiz</servlet-name>
<url-pattern>/Picbiz</url-pattern>
</servlet-mapping>
这个web.xml里面已经申明了而且
package com.jsp.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.jsp.bean.Admin;
import com.jsp.bean.Pic;
import com.jsp.bean.Picbean;
import com.jspsmart.upload.File;
import com.jspsmart.upload.Files;
public class Picbiz extends HttpServlet{
private String info="";
dopost里面略去,主要是
:
if (info.equals("userDeletePhoto")) {
this.user_deletePhoto(request, response);
}
然后又定义了一个方法
private void user_deletePhoto(HttpServletRequest request,
HttpServletResponse response) throws IOException, ServletException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
Integer id = Integer.valueOf(request.getParameter("id"));
Picbean picbean= new Picbean();
picbean.delete(id);
request.getRequestDispatcher("dealwith.jsp").forward(request, response);
}
private void forward_index(HttpServletRequest request,
HttpServletResponse response) {
}
然后页面的话plist1.jsp
<%
Connection conn = DataBaseConnection.getConnection();
String sql="select pname,author,pid from photo where ad=1";
PreparedStatement psmt= conn.prepareStatement(sql);
ResultSet rst= psmt.executeQuery();%>
<table>
</tr><% while(rst.next()){
String rst1=rst.getString(1);
String rst2=rst.getString(2);
int rst3=rst.getInt(3);
System.out.println("rst3 is "+rst3);
%>
<tr><td> 作者:<%=rst2%></td><td width="100"><a href="Picbiz?info=userDeletePhoto&id=rst3">删除此相片</a>
</td><td>图片:<img src=upload/<%=rst1%> width="200" height="220"></td> 展开
展开全部
你这个是缺jar包吧,com/jspsmart/upload/Files 这好像是jspsmart.jar里的类
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |