Jsp登录语句!帮忙看看
<%@page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<html>
<jsp:useBean id="user" scope="page" class="user.db" />
<%
Connection con = user.getConn() ;
Statement stmt = con.createStatement() ;
String userid = request.getParameter("nameId") ;
userid = user.ex_chinese(userid) ;
String pwd = request.getParameter("pwd") ;
pwd = user.ex_chinese(pwd) ;
String sql = "select from visiter where 用户名='"+userid+"' and 密码='"+pwd+"'" ;
ResultSet rs = stmt.executeQueary(sql) ; //有问题???
if (rs.next())
{
....
}
try {
stmt.close();
con.close();
String msg = "登录成功!" ;
}
catch (Exception ex) {
}
%>
<body>
<%=msg%>
</body>
</html>
我的添加是成功的.现在是个登录的判断,就是数据库有纪录就登录 没有就不登录.
方法有 我不会写JSP的语句
大家看看怎样写??
3x