⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 process.jsp

📁 这个程序是我们学习JSP的时候做的一个课程设计,是关于动态网页和TOMCAT相结合,然后使用ODBC作为后台数据库.
💻 JSP
字号:
<%@ page contentType="text/html;charset=gb2312" import="java.sql.*"%>
<jsp:useBean id="conn" class="dbBean.DBBean" scope="session"/>
<jsp:setProperty name="conn" property="connStr" value="jdbc:odbc:user"/>
<%
	session.setMaxInactiveInterval(-1);
	//获取用户名
	String username=request.getParameter("username");
	//将获得的用户名进行内码转换,防止中文乱码问题
	username=new String(username.getBytes("8859_1"));
	//获取口令
	String password=request.getParameter("password");
	//对口令进行编码转换
	password=new String(password.getBytes("8859_1"));
	ResultSet  rs=null;
	String sql="select * from user where name='"+username+"' and password='"+password+"'";
	rs = conn.executeQuery(sql);
	if(rs.next())
	{
		session.setAttribute("loginId",rs.getString("id"));
		session.setAttribute("username",rs.getString("name"));
		rs.close();
		conn.close();
		response.sendRedirect("home.jsp");
	}
	else   	
	{
		rs.close();
		conn.close();
		response.sendRedirect("login.htm");
	}
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -