我在调试我的一个JSP+SQL SERVER 2000的WEB页面时候出现了下面的错误,开始的时候我把数据库连接方面的问题解决了,现在就出现了这个问题额? 这个问题是什么原因的呢,说不能编译类???,我的类在JAVABEAN文件夹里 在我上次发表的问题理没有人回答,有个人说没有导入包,我想他说的意思是不是说这个“IMPORT JAVA.UTIL.* JAVA.SQL.*”这个啊 ?? 这个有额 那还会是什么原因呢?、 各位可以发表下自己的见解吗??
type Exception reportmessage
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:415)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:308)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperException: Unable to compile class for JSP:
type Exception reportmessage
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:415)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:308)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperException: Unable to compile class for JSP:
解决方案 »
- 求一句hql语句
- 问 两个JSP小问题
- 关于一个年份日期的错误500 Servlet Exception java.lang.NumberFormatException: For input string:"9-"
- SQL2005连接提示:到主机的TCP/IP连接失败。
- 怎么使一个APACHE带若干个TOMCAT或RESIN?
- org.apache.jasper.JasperException: 4此提示是指那错了???
- 值得思考的问题
- 下载mod_jk2.dll遇到问题....
- jsp为什么总是提示:variable request ?
- springmvc 在maven下最近发现的新问题,请大神帮忙,谢谢
- 关于myeclipse的问题
- 求教~
An error occurred at line: 163 in the jsp file: /list.jsp
shop.Bookinfo cannot be resolved to a type 只是行数163换成了别的了
我的页面首页里有IMPORT SQL.* UTIL.* 也就是他们说的导包把?能分析下马?会使什么原因呢造成的呢 大家一起帮忙分析下把...
没导包,编译找不到这个类,所以没生成成功,
但问题依旧
呜呜~ 这个鬼问题都搞死我了 ,都弄了一个整月了,CSDN里都发了四个相同的帖了是我加的方法错了吗?我下面加的方法吗?<%@ page session="true" %>
<%@ page import="java.sql.*,java.util.*,shop.Bookinfo" %>
<html>
<head>
shop.Bookinfo换shop.* 试试
<%@ page session="true" %>
<%@ page import="shop.Bookinfo,java.sql.*,java.util.*" %>
<html>
<head>
<title>JSP在线书店</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<%
String loginSign=(String)session.getValue("loginSign"); //获得登陆状态(OK/NO)
if(loginSign.equals("OK"))
{
%><body bgcolor="#F4F5FF" onLoad="MM_preloadImages('images/bb1_1.jpg','images/bb2_1.jpg','images/bb3_1.jpg','images/bb4_1.jpg','images/bb5_1.jpg')">
<font face="Times New Roman,Times" size="+3"> </font>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="540" height="120">
<param name="movie" value="images/8.swf">
<param name="quality" value="high">
<embed src="images/8.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="540" height="120"></embed>
</object>
<table width="78%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="20%"><img src="images/logo.jpg" width="230" height="120"></td>
<td width="80%"> </td>
</tr>
</table>
<hr>
<p>
<center>
<b><font color="#3300CC" size="+3" face="华文行楷">JSP在线书店</font></b><table border="1">
<tr> <td width="72"><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image1','','images/bb1_1.jpg',1)"><img src="images/bb1.jpg" alt="欢迎光临朱银香的JSP书店" name="Image1" width="160" height="46" border="0"></a></td>
<td width="80"><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image2','','images/bb2_1.jpg',1)"><img src="images/bb2.jpg" alt="欢迎光临朱银香的JSP书店" name="Image2" width="160" height="45" border="0"></a></td>
<td width="40"><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image3','','images/bb3_1.jpg',1)"><img src="images/bb3.jpg" alt="欢迎光临朱银香的JSP书店" name="Image3" width="160" height="45" border="0"></a></td>
<td width="88"><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image4','','images/bb4_1.jpg',1)"><img src="images/bb4.jpg" alt="欢迎光临朱银香的JSP书店" name="Image4" width="160" height="45" border="0"></a></td>
<td width="68"><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image5','','images/bb5_1.jpg',1)"><img src="images/bb5.jpg" alt="欢迎光临朱银香的JSP书店" name="Image5" width="160" height="45" border="0"></a></td>
</tr>
<%! String item;%>
<%! String[] title,author,pubhouse;%>
<%! float[] price;%>
<%! int[] id;%><%! float totalAmount; %>
<%! int count,removeNo,i; %>
<%! boolean isExist;%>
<%
try
{
String sDBDriver="com.microsoft.jdbc.sqlserver.SQLServerDriver";
Class.forName(sDBDriver).newInstance(); //加载驱动
String sConnStr="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=Web";
String username="sa";
String passwords="";
Connection connWeb=DriverManager.getConnection(sConnStr,username,passwords); // 创建连接
Statement stmt=connWeb.createStatement();
String query="select bookname,author,price,publichouse,bookid from book_info";
ResultSet rs=stmt.executeQuery(query);
i=0;
while(rs.next())
{
i++;
}
title=new String[i];
author=new String[i];price=new float[i];
pubhouse=new String[i];id=new int[i];
i=0;rs=stmt.executeQuery(query);
while(rs.next())
{
title[i]=rs.getString(1);
author[i]=rs.getString(2);
price[i]=rs.getFloat(3);
pubhouse[i]=rs.getString(4);
id[i]=rs.getInt(5);
%><tr>
<td><%= title[i] %></td>
<td><%= author[i] %></td>
<td><%= price[i] %></td>
<td><%= pubhouse[i] %></td><td><A href="list.jsp?action=add&item=<%= i%>"><img src="images/wing_20.jpg" width="160" height="46"></a></td>
</tr>
<%
i++; }
rs.close();
stmt.close();
connWeb.close();
}
catch(Exception e)
{
out.println(e.getMessage());
}
%>
</table>
<% String action=request.getParameter("action");
if(action!=null)
{
%>
<form action="purchase.jsp" mothod="post">
您的购物车中有以下物品:
<table border="1">
<tr>
<td>booktitle</td>
<td>bookauthor</td>
<td>price</td>
<td>publichouse</td>
<td>Quantity</td>
<td>--------</td>
</tr>
<%
isExist=false;
Vector buyList=(Vector)session.getValue("shoppingcart");
item=request.getParameter("item");
int bookID;
shop.Bookinfo cart=new shop.Bookinfo(); try
{
bookID=Integer.parseInt(item);
if(action.equals("add"))
{
cart.setId(id[bookID]);
cart.setBookname(title[bookID]);
cart.setAuthor(author[bookID]);
cart.setPrice(price[bookID]);
cart.setQuantity(1);
cart.setPublichouse(pubhouse[bookID]); if (buyList==null)
{
buyList = new Vector();
buyList.addElement(cart);
}
else
{
for (int i=0;i<buyList.size();i++)
{
int tempid=((shop.Bookinfo)buyList.elementAt(i)).getId();
int tmp=((shop.Bookinfo)buyList.elementAt(i)).getQuantity();
if(tempid==cart.getId())
{
isExist=true;
((shop.Bookinfo)buyList.elementAt(i)).setQuantity(tmp+1);
}
}
if(!isExist)
buyList.addElement(cart);
}
}
if(action.equals("del"))
{
for (int i=0;i<buyList.size();i++)
{
int tempid=((shop.Bookinfo)buyList.elementAt(i)).getId();
if (tempid==bookID)
removeNo=i;
}
buyList.removeElementAt(removeNo);
}
session.putValue("shoppingcart",buyList);
totalAmount=0;
for(int i=0;i<buyList.size();i++)
{
out.println("<tr>");
out.println("<td>");
out.println(((shop.Bookinfo)buyList.elementAt(i)).getBookname());
out.println("</td>");
out.println("<td>");
out.println(((shop.Bookinfo)buyList.elementAt(i)).getAuthor());
out.println("</td>");
out.println("<td>");
out.println(((shop.Bookinfo)buyList.elementAt(i)).getPrice());
out.println("</td>");
out.println("<td>");
out.println(((shop.Bookinfo)buyList.elementAt(i)).getPublichouse());
out.println("</td>");
out.println("<td>");
out.println(((shop.Bookinfo)buyList.elementAt(i)).getQuantity());
out.println("</td>");
out.println("<td>");
int tmp=((shop.Bookinfo)buyList.elementAt(i)).getId();
int tmpQuantity=((shop.Bookinfo)buyList.elementAt(i)).getQuantity();
float price=((shop.Bookinfo)buyList.elementAt(i)).getPrice();
float booktotal=price*tmpQuantity;
totalAmount=totalAmount+booktotal;%>
<A href="list.jsp?action=del&item=<%= tmp%>">暂时不购买:)</a><%
out.println("</td>");
out.println("</tr>");
}
out.println("</table>");
out.println("total:"+totalAmount);
out.println("<input type=\"submit\" value=\"submit\">");
}
catch(Exception e)
{
out.println(e.getMessage());
}
}
}
%>
</form>
</center>
</body>
</html>
朋友 我照你说的做了,我的环境变量和变量名如下,你看看又问题不?
classpath: .;C:\Program Files\Java\jdk1.6.0_10\lib\dt.jar;C:\Program Files\Java\jdk1.6.0_10\lib\tools.jar;C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib;C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\msbase.jar;C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\msutil.jar;C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\mssqlserver.jar
path: %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Java\jdk1.6.0_10\bin;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;C:\Program Files\Common Files\Thunder Network\KanKan\Codecstomcat_home: C:\Program Files\Apache Software Foundation\Tomcat 6.0java_home: C:\Program Files\Java\jdk1.6.0_10
pageEncoding="gb2312"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
换成gb2312