<%@ 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.
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.
是不是还有className没带上去
这句话的意思是从页面作用域寻找conn的jdbc.ConnMysql类型的实例。如果为空,就创建一个。
jdbc.ConnMysql类必须存在,且包括一个无参的构造方法
class里也不能指定接口,接口要使用type属性
这句话不是应该写成sql="select * from user where UserName='"+name+"' and Password='"+password+"'";
ConnMysql里面虽然有,但你有没有调用它啊再说,关于数据库的操作,怎么不在javabean里面处理,直接返回结果就好啦!
pageEncoding="UTF-8"%>