Results 1 to 2 of 2

Thread: jsp-mysql

  1. #1
    pardhu is offline Member
    Join Date
    Oct 2011
    Rep Power

    Default jsp-mysql

    hi friends,
    i am new to jsp and my doubt may seem very funny to you all but without clarifying it i can't move on with my project .
    i wrote a simple jsp program which accepts the name and password values from the user and compares them with the values in the database and displays 'correct' if they match and 'wrong' if they doesn't match.
    i am not using any IDE. i am writing the programs in notepad files and executing them

    here's the html page that reads values from the user
    Java Code:
    <form action="check.jsp" method=get>
    uname:<input type="text" name="name"><br>
    <input type="password" name="pass"><br>
    <input type="submit" value="submit">
    here's the jsp program
    Java Code:
    <%@ page import="java.sql.*"%>
    <%@ page import="*"%>
    String name=request.getParameter("name");
    String pass=request.getParameter("pass");
    Connection con = null;
    ResultSet rs=null;
    Statement stmt;
    String connectionURL = "jdbc:mysql://localhost:3306/pms";;
    con = DriverManager.getConnection(connectionURL, "root", "root");
     rs = stmt.executeQuery("select * from login where name='"+name+"' and password='"+pass+"'");
        catch(Exception e){
    here's the html page that displays the message correct
    Java Code:
    here's the html page that displays the message
    Java Code:
    here's the web.xml file
    Java Code:
    when i enter name and password fields and press enter, a blank page is displayed and i cant get the output. the address bar contains "http://localhost:8080/pms/check.jsp?name=abc&pass=abc"

    what is the problem with my program ?
    pls anyone help me guys...
    its important for me
    Last edited by pardhu; 02-09-2013 at 04:03 PM.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Rep Power

    Default Re: jsp-mysql

    This is not the sort of thing a JSP is for.
    JSPs display the results of processing done by a servlet.
    So your above should be in a servlet, and that should forward to the relevant HTML page.
    Servlets are a lot easier to debug.

    Anyway, are you sure there is an entry in your database for username abc and password abc?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Java DB, MySQL and MySQL Connector/J
    By jimihunter007 in forum JDBC
    Replies: 2
    Last Post: 07-30-2012, 05:23 AM
  2. Replies: 4
    Last Post: 03-04-2012, 11:26 PM
  3. MySQL
    By PhQ in forum New To Java
    Replies: 6
    Last Post: 04-03-2010, 12:54 PM
  4. MySQL/JDBC Mysql query output
    By thelinuxguy in forum Advanced Java
    Replies: 4
    Last Post: 02-13-2009, 01:57 AM
  5. Mysql Help
    By Sumendra Maharjan in forum JDBC
    Replies: 1
    Last Post: 08-08-2007, 01:19 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