tomcat的unable to compile class for jsp的问题,简单的页面能编译,连接数据库的就不能了。
我输出简单的jsp页面能编译出来,如:
   <%   String s="HELLO WORLD"; %>
   <%=s%>
可是以下代码就不行了(连接Oracle数据库的操作)!
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%><%@ page import="java.sql.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
   <head>
     <title>My JSP 'index.jsp' starting page</title>
   </head>                                                                                                                                
   <body><br>
  [size=14px] <%!
    public static final String DBDRIVER = "oracle.jdbc.driver.OracleDriver" ;
  public static final String DBURL = "jdbc:oracle:thin:@localhost:1521:test" ;
  public static final String DBUSER = "scott" ;
  public static final String DBPASSWORD = "tiger" ;
  %>
  <%
   Conntection conn=null;
   PreparedStatement pst=null;
   ResultSet rs=null;[/size]
.........
就报错:
org.apache.jasper.JasperException: Unable to compile class for JSP: 
An error occurred at line: 20 in the jsp file: /emp_list.jsp
Conntection 
cannot be resolved to a type
17: public static final String DBPASSWORD = "tiger" ;
18: %>
19: <%
20:  Conntection conn=null;
21:  PreparedStatement pst=null;
22:  ResultSet rs=null;
------解决方案--------------------
Conntection conn=null;
这句不是写错了吗。是Connection
------解决方案--------------------呵呵 楼上的发现了 ,但是代码不规范,现在谁还把 操作数据库的代码放在 jsp页面??你应该学些dao模式。。
我的异常网推荐解决方案:org.apache.jasper.JasperException: Unable to compile class,http://www.aiyiweb.com/j2ee/2308.html