<%@ page language="java" contentType="text/html; charset=UTF-8" import="java.sql.*" errorPage=""
    pageEncoding="UTF-8"%>
<!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=UTF-8">
<title>登录系统</title>
</head>
<body>
<jsp:useBean id="conn" scope="page" class="jdbc.ConnMysql"></jsp:useBean>
<%!
String sql=null;
    String str=null; 
    ResultSet resultSet=null;
%>
<% 
request.setCharacterEncoding("UTF-8");
String name=request.getParameter("text1");
String password=request.getparameter("text2");
sql="select * from user where UserName="+name+"and Password="+password;
 resultSet=conn.getExecuteQuery(sql);
if(resultSet.next())
{
response.sendRedirect("df.jsp");
}
%></body>
</html>
本人是初学者,望各位前辈能指点指点,系统报错说是org.apache.jasper.JasperException: /Check.jsp(11,0) The value for the useBean class attribute jdbc.ConnMysql is invalid.

解决方案 »

  1.   

    jdbc.ConnMysql 无效
    是不是还有className没带上去
      

  2.   

    你的数据库连接语句都没有啊,怎么select?
      

  3.   

    <jsp:useBean id="conn" scope="page" class="jdbc.ConnMysql"></jsp:useBean>
    这句话的意思是从页面作用域寻找conn的jdbc.ConnMysql类型的实例。如果为空,就创建一个。
    jdbc.ConnMysql类必须存在,且包括一个无参的构造方法
    class里也不能指定接口,接口要使用type属性
      

  4.   

    你检查一下 在SRC下 是否有个包叫jdbc 以及里面有个类是ConnMysql
      

  5.   

    数据库连接语句在ConnMysql里面啊!
      

  6.   

    sql="select * from user where UserName="+name+"and Password="+password;
    这句话不是应该写成sql="select * from user where UserName='"+name+"' and Password='"+password+"'";
      

  7.   


    ConnMysql里面虽然有,但你有没有调用它啊再说,关于数据库的操作,怎么不在javabean里面处理,直接返回结果就好啦!
      

  8.   

    关于数据库的处理我就是在Bean里面处理的啊!不过系统总是说我写的这个Bean不合法!为什么啊!
      

  9.   

    在第一句的import那里导入jdbc.ConnMysql。详见红色字体部分<%@ page language="java" contentType="text/html; charset=UTF-8" import="java.sql.*,jdbc.ConnMysql" errorPage=""
      pageEncoding="UTF-8"%>