failure to log in

failure to log in

<blockquote>
  <p>Blockquote</p>
</blockquote>

<p>&lt;%@page contentType="text/html"%>
&lt;%@page pageEncoding="UTF-8"%>
&lt;%@page import="java.sql.Connection" %>
&lt;%@page import="java.sql.DriverManager" %>
&lt;%@page import="java.sql.Statement" %>
&lt;%@page import="java.sql.ResultSet" %>
&lt;%@page import="java.sql.PreparedStatement" %>
&lt;%@page import="java.sql.SQLException" %></p>

<p><html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>Login</title>
    </head>
    &lt;%
        String userName = request.getParameter("username");
        String password = request.getParameter("password");
        String rm<em>me = request.getParameter("rm</em>me");
        String rm<em>uname = request.getParameter("rm</em>uname");</p>

<pre class="prettyprint">    if (userName != null &amp;&amp; password != null) {
        if (rm_me != null) {
            Cookie ckU = new Cookie("username", userName);
            Cookie ckP = new Cookie("password", password);
                   response.addCookie(ckP);
        } else {
            if (rm_uname != null) {
                Cookie ckU = new Cookie("username", userName);

            }
        }

        try {

        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

            Connection conn = DriverManager.getConnection("jdbc:odbc:mydsn","sa","password@123");

            String sql = "select customer_id, fname, lname, email_id, phone_number from customer_details where user_name=? and password=?";
            PreparedStatement stmt;

            ResultSet rs = stmt.executeQuery();

            if (rs.next()) {
                session.setAttribute("customerId", rs.getString(1));
                session.setAttribute("userName", userName);
                session.setAttribute("fName", rs.getString(2));
                session.setAttribute("lName", rs.getString(3));
                session.setAttribute("emailId", rs.getString(4));
                session.setAttribute("phoneNumber", rs.getString(5));
                conn.close();
          %&gt;
                &lt;jsp:forward page="welcome.jsp" /&gt;
          &lt;%} else {%&gt;


        Sorry! You have entered an invalid username or password. Please try again.
          &lt;%}
            conn.close();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
%&gt;
&lt;body&gt;
    &lt;p&gt; &lt;/p&gt;
    &lt;p&gt; &lt;/p&gt;
    &lt;p&gt; &lt;/p&gt;
    &lt;p&gt; &lt;/p&gt;

    &lt;%
    Cookie[] cookies = request.getCookies();
    if (cookies != null) {
        for (int i = 0; i &lt; cookies.length; i++) {
            if (cookies[i].getName().equals("username")) {
                userName = cookies[i].getValue();
            }
            if (cookies[i].getName().equals("password")) {
                password = cookies[i].getValue();
            }
        }
    }
    %&gt;

    &lt;form name="LoginForm" id="LoginForm" method=post Action="login.jsp"&gt;
        &lt;table width="70%" align="center" border="1"&gt;

            &lt;tr&gt;
                &lt;td&gt;&lt;img src="logo.jpg"&gt;&lt;/img&gt;&lt;/td&gt;
                &lt;td&gt;Lets conserve our environment&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
                &lt;td align="center"&gt;User Name&lt;/td&gt;
                &lt;td&gt;&lt;input type="text" name="username" maxlength="50" value="&lt;%=(userName==null?"":userName)%&gt;"/&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
                &lt;td align="center"&gt;Password&lt;/td&gt;
                &lt;td&gt;&lt;input type="password" name="password" maxlength="100" value="&lt;%=(password==null?"":password)%&gt;"/&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
                &lt;td&gt; &lt;/td&gt;
                &lt;td&gt;
                    &lt;input type="submit" name ="login" value="Login" /&gt;
                &lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
                &lt;td align="center"&gt;
                    &lt;input type="checkbox"  name="rm_uname" value="RememberUsername" /&gt;Remember Username
                &lt;/td&gt;
                &lt;td&gt;
                    &lt;input type="checkbox"  name="rm_me" value="RememberMe" /&gt;Remember Me
                &lt;/td&gt;
            &lt;/tr&gt;
        &lt;/table&gt;
    &lt;/form&gt;
&lt;/body&gt;
</code></pre>

<p></html></p>

<blockquote>
  <p>Blockquote</p>
</blockquote>

<p>can someone help to identify the error because even when the username and password are provided the error message appers indicating failure to loggin. </p>
View Answers

March 12, 2011 at 5:46 PM









Related Tutorials/Questions & Answers:
failure to log in
failure to log in  <blockquote> <p>Blockquote</p> </blockquote> <p>&lt;%@page contentType="text/html"%>... failure to loggin. </p>   Please visit the following links: http
ModuleNotFoundError: No module named 'failure'
ModuleNotFoundError: No module named 'failure'  Hi, My Python... 'failure' How to remove the ModuleNotFoundError: No module named 'failure... to install padas library. You can install failure python with following command
Advertisements
build failure error with maven
build failure error with maven  hi, when i clean install a maven file I am getting the error in command prompt like sun.misc.BASE64Encoder is Sun proprietary API and may be removed in a future release. There are several
ModuleNotFoundError: No module named 'importlib-no-failure'
ModuleNotFoundError: No module named 'importlib-no-failure'  Hi...: No module named 'importlib-no-failure' How to remove the ModuleNotFoundError: No module named 'importlib-no-failure' error? Thanks   Hi
Describe the effects of a server failure on the application
Describe the effects of a server failure on the application Prev  Chapter 7. Validate, tune and troubleshoot... Describe the effects of a server failure on the application
log in
log in  sir i designed one login.jsp page with one form, username,login,and one submit button .if i enter username and password its been verify the mydatabase in in table in the field of username and password while it s correct
com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: Communications link failure due to underlying exception
com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: Communications link failure due to underlying exception  Hi, In my application...: com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: Communications link failure due to underlying exception
if my database(oracle) connection failure means wat is the code to write in exception ?
if my database(oracle) connection failure means wat is the code to write in exception ?  if my database(oracle) connection failure means wat is the code to write in exception
How to detect system failure using java code - Java Beginners
How to detect system failure using java code  I am doing a project... to detect the process that make failure. I have no idea about the project so please help me. And i need some site to download java source code
Log-in Valdidation
Log-in Valdidation  how to create login validation in jsp
log out
log out  how do i create a log out on a project without it exiting system so it does not reload again
log 4j
log 4j  what is log4j? can you give me clear information about log4j?   Please go through the following link: log4j Tutorials
error log
error log  hi my requirement is validate xml and xsd in java.If there is an errors then i will log error and store into error table. so plz if any one knows send code urgent. error table details-------------- Table
Writing Log Records to a Log File
Writing Log Records to a Log File       This section demonstrates for writing log records to a log file. Logger provides different types of level like: warning, info
keeping log of page load - Java Beginners
to keep a log of if the page has succesfuuly loaded or not. It means I want to keep log for sucess and failure both for page loading. Can you please give me some...keeping log of page load  Hello, I have a project and I need
ModuleNotFoundError: No module named 'log'
ModuleNotFoundError: No module named 'log'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'log' How to remove the ModuleNotFoundError: No module named 'log' error
log in page
log in page  hi all i want to create a login page in jsp which should be validated using ajax. please help me dong that with code...   Here is a jsp example that accepts username and password from the user and check
Version of taglibs>log dependency
List of Version of taglibs>log dependency
Version of co.trikita>log dependency
List of Version of co.trikita>log dependency
Version of com.techshroom>Log dependency
List of Version of com.techshroom>Log dependency
user log in according to their role
user log in according to their role  i want a jsp code for different users log in to different pages according to their role.example normal user and administrator. normal user for user page and administrator for admin page
user log in according to their role
user log in according to their role  i want a jsp code for different users log in to different pages according to their role.example normal user and administrator. normal user for user page and administrator for admin page
Artifacts of com.splinter-log
List of Artifacts of com.splinter-log maven depenency
error log and send Database
error log and send Database  hi my requirement is validate xml and xsd in java.If there is an errors then i will log error and store into error table. so plz if any one knows send code urgent. error table details
Version of taglibs>log-doc dependency
List of Version of taglibs>log-doc dependency
Version of taglibs>log-examples dependency
List of Version of taglibs>log-examples dependency
Version of com.17jee>e-log dependency
List of Version of com.17jee>e-log dependency
Version of com.amlinv>log-utils dependency
List of Version of com.amlinv>log-utils dependency
Version of com.globalmentor>globalmentor-log dependency
List of Version of com.globalmentor>globalmentor-log dependency
Version of com.identityblitz>log-lib dependency
List of Version of com.identityblitz>log-lib dependency
Version of com.logicartisan>log-indexer dependency
List of Version of com.logicartisan>log-indexer dependency
Version of com.lukekorth>mailable_log dependency
List of Version of com.lukekorth>mailable_log dependency
Version of com.mycila>mycila-log dependency
List of Version of com.mycila>mycila-log dependency
ModuleNotFoundError: No module named 'admin-log'
ModuleNotFoundError: No module named 'admin-log'  Hi, My Python... 'admin-log' How to remove the ModuleNotFoundError: No module named 'admin-log' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'captains-log'
ModuleNotFoundError: No module named 'captains-log'  Hi, My Python... 'captains-log' How to remove the ModuleNotFoundError: No module named 'captains-log' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'clive-log'
ModuleNotFoundError: No module named 'clive-log'  Hi, My Python... 'clive-log' How to remove the ModuleNotFoundError: No module named 'clive-log' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'clive-log'
ModuleNotFoundError: No module named 'clive-log'  Hi, My Python... 'clive-log' How to remove the ModuleNotFoundError: No module named 'clive-log' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'color-log'
ModuleNotFoundError: No module named 'color-log'  Hi, My Python... 'color-log' How to remove the ModuleNotFoundError: No module named 'color-log' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'con-log'
ModuleNotFoundError: No module named 'con-log'  Hi, My Python...-log' How to remove the ModuleNotFoundError: No module named 'con-log... to install padas library. You can install con-log python with following command
ModuleNotFoundError: No module named 'context-log'
ModuleNotFoundError: No module named 'context-log'  Hi, My Python... 'context-log' How to remove the ModuleNotFoundError: No module named 'context-log' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'django-log'
ModuleNotFoundError: No module named 'django-log'  Hi, My Python... 'django-log' How to remove the ModuleNotFoundError: No module named 'django-log' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'eth-log'
ModuleNotFoundError: No module named 'eth-log'  Hi, My Python...-log' How to remove the ModuleNotFoundError: No module named 'eth-log... to install padas library. You can install eth-log python with following command
ModuleNotFoundError: No module named 'eventlet_log'
ModuleNotFoundError: No module named 'eventlet_log'  Hi, My Python... 'eventlet_log' How to remove the ModuleNotFoundError: No module named 'eventlet_log' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'eventlet_log'
ModuleNotFoundError: No module named 'eventlet_log'  Hi, My Python... 'eventlet_log' How to remove the ModuleNotFoundError: No module named 'eventlet_log' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'http-log'
ModuleNotFoundError: No module named 'http-log'  Hi, My Python... 'http-log' How to remove the ModuleNotFoundError: No module named 'http-log... to install padas library. You can install http-log python with following
ModuleNotFoundError: No module named 'log-aggregator'
ModuleNotFoundError: No module named 'log-aggregator'  Hi, My... named 'log-aggregator' How to remove the ModuleNotFoundError: No module named 'log-aggregator' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'log-analyzer'
ModuleNotFoundError: No module named 'log-analyzer'  Hi, My Python... 'log-analyzer' How to remove the ModuleNotFoundError: No module named 'log-analyzer' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'log-annotation'
ModuleNotFoundError: No module named 'log-annotation'  Hi, My... named 'log-annotation' How to remove the ModuleNotFoundError: No module named 'log-annotation' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'log_calls'
ModuleNotFoundError: No module named 'log_calls'  Hi, My Python... 'log_calls' How to remove the ModuleNotFoundError: No module named 'log... have to install padas library. You can install log_calls python with following
ModuleNotFoundError: No module named 'log-color'
ModuleNotFoundError: No module named 'log-color'  Hi, My Python... 'log-color' How to remove the ModuleNotFoundError: No module named 'log... have to install padas library. You can install log-color python with following

Ads