moon207 0 Newbie Poster

hello everybody,
I'm new to jsp.I have to develope web portal for my company but i had problem with my login page. I hope that you can help this problem. Here is the code:

<%@ page contentType="text/html" 
    import="java.sql.*, java.util.Date, java.io.*" %>
<%!
String CheckLogin(String Login, String Password) throws Exception
{
    Connection con = null;
    ResultSet rs = null;
    String result = null;
    String strSQL = "";

    try{

        Class.forName( "org.postgresql.Driver" );
        con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/web_portal","postgres","williamlcs"); 

        strSQL = "SELECT * FROM all_user WHERE user_login=?";
        PreparedStatement ps = con.prepareStatement(strSQL);
        ps.setString(1,Login);
        rs = ps.executeQuery();
        if(!rs.next())
            result = "Invalid Account";
        else if(!rs.getString("user_pwd").equals(Password))
            result = "Invalid Password";
        else
            result = "loginSucc";
        ps.close();
    }
    catch(Exception ex){
        throw ex;
    }
    finally{
        rs.close();
        con.close();
    }

    return result;
}
%>
<%
String UserNm = request.getParameter("UserNm");
String UserPasswd = request.getParameter("UserPasswd");

String strCheckLogin = CheckLogin(UserNm, UserPasswd);

if(strCheckLogin.equals("loginSucc")){
    session.setAttribute("UserNm", UserNm);
    session.setAttribute("UserPasswd", UserPasswd);
    response.sendRedirect("IT.html");
}
%>

<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<TITLE>Login</TITLE>
</HEAD>
<CENTER>
<FONT size="5" color="blue">Admin Login</FONT>
</CENTER>
<HR>
<CENTER>
<%= strCheckLogin %><P></P><A href="homepage.html">

</CENTER>
</BODY>
</HTML>