日期:2014-05-17  浏览次数:20914 次

JSP编译失败的问题
各位老师,小弟刚开始学JSP,在做一个用户验证的过程中,出现了一点问题,自己也找了问题,也没理清楚,所以到此请教,忘各位不吝赐教!

开发环境:
IDE:eclipse
TOMCAT:7.0
DB:SQL2000

问题描述:
在login登录后,进行loginCL.jsp的时候,进行报错,报错提示如下:

type Exception report

message Unable to compile class for JSP: 

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: 

An error occurred at line: 16 in the jsp file: /WebContent/loginCL.jsp
UserBeanCL cannot be resolved to a type
13:  String p = request.getParameter("password");
14: 
15:  //验证用户名和密码,调用UserBeanCL的checkUser方法
16:  UserBeanCL ubcl = new UserBeanCL();
17: 
18:  if(ubcl.checkUser(u, p)){
19:  //设置Session


An error occurred at line: 16 in the jsp file: /WebContent/loginCL.jsp
UserBeanCL cannot be resolved to a type
13:  String p = request.getParameter("password");
14: 
15:  //验证用户名和密码,调用UserBeanCL的checkUser方法
16:  UserBeanCL ubcl = new UserBeanCL();
17: 
18:  if(ubcl.checkUser(u, p)){
19:  //设置Session

PS:我自己也分析了以下,应该不会是UserBeanCL.java出现的问题,是不是那些地方没有设置好?
导致jsp找不到这个类?


以下为涉及到的源码

===login.jsp===

<%@ page language="java" contentType="text/html; charset=gb2312"
    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">
<title>用户管理系统</title>
</head>
<body bgcolor="#CED3FF">
<center>
用户登录<br>
<hr>
<form action="loginCL.jsp" method="post">
用户名:<input type="text" name="username" ><br>
密&nbsp;&nbsp;码:<input type="password" name="password" ><br>
<input type="submit" value="登录" >
<input type="reset" value="重置" >
</form>
</center>
</body>
</html>

===loginCL.jsp===

<%@ page language="java" import="java.util.*,java.sql.*,com.eric.model.*" contentType="text/html; charset=gb2312"
    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">
<title>用户管理系统</title>
</head>
<body bgcolor="#CED3FF">
<%
//接收用户名和密码,完成对用户的验证
String u = request.getParameter("username");
String p = request.getParameter("password");

//验证用户名和密码,调用UserBeanCL的checkUser方法
UserBeanCL ubcl