return conn;是这不对吧
return conntmp
return conntmp
解决方案 »
- 将jsp中table里的数据导出到excel中
- struts2 session
- 左侧树的几个问题,帮个忙
- 100分求救,JasperReport报错:java.lang.NoClassDefFoundError: net/sf/jasperreports/engine/util/JRLoader ?
- struts中验证出的错误
- jsp页面对数据库的操作怎样用事务处理
- 刚学jsp,javabean的问题,望各位大虾门帮忙看看。
- jsp编译问题
- 问两个关于表单的问题,向大家求教!
- jsc的小问题
- 没有分了!还请大家帮忙!JSTL使用SQL时的简单问题!
- Statement与PreparedStatement的区别?
如果是的话,在的“Statement Stmt=conn.createStatement(); ”当然会出错了,因为你定义的类dbconn中并没有实现这个接口“creatStatement()”啊!
除非你在类“DbOperate ”中定义一个这样的接口“public Statement createStatement()”
<%@ page contentType="text/html;charset=gb2312" %>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>登录验证</title>
<link rel="stylesheet" href="bbs.css" type="text/css">
</head>
<body>
<%@ page language="java" import="java.sql.*"%>
<%
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String url="jdbc:oracle:thin:@192.168.1.41:1521:AddrBook";
//AddrBook为你的数据库的SID
String user="system";
String pwd="manager1";
Connection conn= DriverManager.getConnection(url,user,pwd);
String name1=request.getParameter("username");
name1= new String(name1.getBytes("ISO8859-1"),"GBK");
//String nowtime=trim(left(replace(replace(replace(now(),":","")," ",""),"-",""),10))
session.setAttribute("username",name1);
String password=request.getParameter("password");
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="select * from IM_Users where UserName='"+name1+"' and Password='"+password+"'";
ResultSet rs=stmt.executeQuery(sql);
if (rs.next()){
response.sendRedirect("rootok.jsp?username="+name1+"");
rs.close();
%>
<%}
else{
rs.close();
//session.setAttribute("root_message","<font color=red>用户名或密码错误!</font>");
response.sendRedirect("pwerror.htm");
%>
<%}%>
</body>
</html>
if (rs.next()) { //就是这里出的错
User UserRecord = new User(rs.getString(1), rs.getString(2),
rs.getString(3), rs.getString(4));
rs.close(); }
不好吧!还是先使用控制台程序学习吧,学习Java不是学习JSP的,JSP除了标签之外半天就可以了,假如会Servlet的话,不就是个根据JSP里面的东西分析然后生成Servlet源代码吗