Results 1 to 2 of 2
  1. #1
    barney is offline Member
    Join Date
    Jul 2007
    Posts
    40
    Rep Power
    0

    Default Error: javax.servlet.ServletException: Column not found

    Hi. Login.html page is what user use to login which, will take him to validateform.jsp page, in order to check if the user is a register user to have access to the page. Then, the UsePage.jsp is a welcome page that's, if successfully. But the error that i encounter after using Deploytool is
    Java Code:
    HTTP STATUS 500
    javax.servlet.ServletException: Column not found
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:830)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:763)
    org.apache.jsp.ValidateForm_jsp._jspService(ValidateForm_jsp.java:103)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:105)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:336)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:297)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:247)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
    sun.reflect.GeneratedMethodAccessor80.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
    java.security.AccessController.doPrivileged(Native Method)
    javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
    PLEASE REPLY KELLY(NIIT Student). Remain Bless All Developers Amen.
    snookcent@yahoo.com, iykelly4love@yahoo.co.uk
    My table name is Registration.
    Columns are DbUserName and DbPassword.

    XML Code:
    Login.html (Login Page)
    <html>
    <head><title>Please Sign in</title></head>
    <h2>Please Login</h2>
    <body>
    <form method="post" action="http://localhost:8080/valid/ValidateForm.jsp">
    <tr>
    <td>UserName:</td>
    <td><input type="text" name="username"></td>
    </tr><br>
    <tr>
    <td>password:</td>
    <td><input type="password" name="password"></td>
    </tr><br>
    <tr>
    <td><input type="submit" value="Login"></td>
    </tr>
    </form>
    </body>
    </html>
    ValidateForm.jsp
    Java Code:
    <html>
    <head>
    <title>login validator</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <%@ page import="javax.servlet.*" %>
    <%@ page import="javax.servlet.http.*" %>
    <%@ page import="java.sql.*" %>
    
    <body>
    <%
    Connection con = null;
    
    String username = request.getParameter("username");
    String password = request.getParameter("password");
    String DbPassword = "";
    String DbUserName="";
    try
    {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con=DriverManager.getConnection("jdbc:odbc:KellySource", "java", "javaclass");
    
    Statement stmt = con.createStatement();
    ResultSet rs = stmt.executeQuery("select * from Registration");
    
    while(rs.next())
    {
    DbUserName=rs.getString(username);
    DbPassword = rs.getString(password);
    }
    if (username.equals(DbUserName) && password.equals(DbPassword))
    {
    
    }
    else
    {
    
    }
    }
    finally
    {
    con.close();
    }
    response.sendRedirect("UsePage.jsp");
    
    %>
    
    
    </body>
    </html>
    UsePage.jsp

    Java Code:
    <html>
    <head><title>You have Successfully Login</title></head>
    <body bgcolor=bluelight>
    <h2>You have Successfully Login</h2>
    </body>
    </html>
    Thanks.

  2. #2
    zoe
    zoe is offline Member
    Join Date
    Jul 2007
    Posts
    40
    Rep Power
    0

    Default

    Problem is here..
    Java Code:
    DbUserName=rs.getString(username);
    DbPassword = rs.getString(password);
    replace it with
    DbUserName=rs.getString(1);
    DbPassword = rs.getString(2);
    Or
    DbUserName=rs.getString("DbUserName");
    DbPassword = rs.getString("DbPassword");
    The code should be actually
    Java Code:
    String username = request.getParameter("username");
    String password = request.getParameter("password");
    
    while(rs.next()) {
    DbUserName=rs.getString(1);
    DbPassword = rs.getString(2);
    if (username.equals(DbUserName) && password.equals(DbPassword)) {
    
    }
    else {
    
    }
    
    }

Similar Threads

  1. Error: no class definition found
    By toby in forum New To Java
    Replies: 6
    Last Post: 08-28-2011, 10:32 PM
  2. javax.servlet.ServletException:Can't get definitions factory
    By Peter in forum JavaServer Faces (JSF)
    Replies: 3
    Last Post: 12-02-2008, 07:29 AM
  3. Replies: 6
    Last Post: 10-08-2008, 08:09 AM
  4. Replies: 1
    Last Post: 08-07-2007, 03:47 PM
  5. Replies: 1
    Last Post: 08-01-2007, 06:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •