loginvalid.jsp

来自「share trading application.My code sample」· JSP 代码 · 共 50 行

JSP
50
字号
<%@ page errorPage = "ErrorPage.jsp" language="java" import="java.sql.*" %>
<%
/*Verifying the second level login entered by the customer with Customer_Master table of the savv.mdb database. */
Connection conn=null;
PreparedStatement stmt;
ResultSet rs=null;
try
{
String cid, pswd;
cid="";
pswd="";
int i=0;
cid=request.getParameter("cid");
pswd=request.getParameter("pswd");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:vinn");
stmt=conn.prepareStatement("select * from customer_master where cid=? and Password=? ");
stmt.setString(1,cid);
stmt.setString(2,pswd);
rs=stmt.executeQuery();
while(rs.next())
{
i++;
out.println(i);
System.out.println(i);
}
if(i>0)
{
/*Creating a session variable to keep track of the CustomerID in the whole application. */
session.putValue("CUSTID",cid);
%>
<jsp:forward page="sellbuy2.htm" />
<%
out.println("Welcome to Investmentz.com");
%>
<%
}else{
%>
<script language="javascript">
<!桪ispalying the alert message, if the second level login is incorrect. -->
alert("Invalid CustomerID/password. Please Re-enter");
location.href="login.jsp"
</script>
<%
}
conn.close();
}
catch(SQLException ee){out.println(ee);}
%>

⌨️ 快捷键说明

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