Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_jsp thread: Buttons


Message #1 by "Johan Ruttens" <ruttens_johan@h...> on Tue, 8 May 2001 21:40:22
He!
I'm Ananda,India.Code is below.
<html>
<%@ page language="java" import="java.sql.*;" %>
<body>
<h1>Checked your UserId and Password</h1>
<%   String s1=request.getParameter("user"); %>
<%   String s2=request.getParameter("pass"); %>

<%
  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
 %>
<% 
  Connection con = DriverManager.getConnection("jdbc:odbc:ananda"); 
 %>
<%
   Statement stm = con.createStatement();
   ResultSet myresult = stm.executeQuery("select * from login"); 
%>
<%  while (myresult.next()) 
   { 
   String id = myresult.getString("userid"); 
   String pa = myresult.getString("password"); 
	   if((id.equals(s1)) && (pa.equals(s2))) 
       out.println("Your UserId or Password is 
correct."+id+"   "+pa+"     "+s1+"     "+s2);      
         else 
       out.println("Your UserId or Password is not 
correct."+id+"   "+pa+"     "+s1+"     "+s2);  
   } 
%>
<% 
   stm.close(); 
   con.close();
%>  
<a href="http://localhost:8080/login.htm">Go Back</a>
</body>
</html> 
   



> Hello,
> 
> I have made a JSP file and also created JavaBean.  I would like to know 
if 
> it is possible to catch events -caused by buttons in the JSP file- in 
the 
> JavaBean.  
> 
> Or do you know a good way to check if the right password is given 
> (password exists in a database) just by using one JSP file and a one 
> JavaBean.
> 

  Return to Index