August 25, 2008 at 3:29 PM
create table `user` (
`user` varchar (256),
`password` varchar (256)
);
insert into `user` (`user`, `password`) values('amit','kumar');
Code for validating servlet is given as below:
1. Validation.java
import java.io.*;
import java.util.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Validation extends HttpServlet{
private ServletConfig config;
public void init(ServletConfig config)
throws ServletException{
this.config=config;
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException,IOException{
PrintWriter out = response.getWriter();
String connectionURL = "jdbc:
mysql://192.168.10.59/messagepaging";;
Connection connection=null;
ResultSet rs;
String userName=new String("");
String passwrd=new String("");
response.setContentType("text/html");
try {
// Load the database driver
Class.forName("com.mysql.jdbc.Driver");
// Get a Connection to the database
connection = DriverManager.getConnection(connectionURL, "root", "root");
//Add the data into the database
String sql = "select user,password from User";
Statement s = connection.createStatement();
s.executeQuery (sql);
rs = s.getResultSet();
while (rs.next ()){
userName=rs.getString("user");
passwrd=rs.getString("password");
}
rs.close ();
s.close ();
}catch(Exception e){
System.out.println("Exception is ;"+e);
}
if(userName.equals(request.getParameter("user"))
&& passwrd.equals(request.getParameter("pass"))){
out.println("User is Valid");
}
else{
out.println("You are not a Valid User");
}
}
}
Related Tutorials/Questions & Answers:
plz. answer my ques - Java Beginnersplz.
answer my ques I want to ask a prog. prob which would create a prog that would simply take username and password as input and will display ***** while taking passwords as input.(As it is done at login in websites).
Also
plz give me answer plzplz give me
answer plz writw a programme to find rank from an array using doubledimmensionalarray
Advertisements
my answermy answer import com.mysql.jdbc.Connection;
import com.mysql.jdbc.Statement;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.ResultSet;
import
plz give me answerplz give me answer description about string class methods
Java string methods
plz give me answerplz give me answer description about string class methods
Java string methods
plz give me answerplz give me answer description about string class methods
Java string methods
plz give me answerplz give me answer Discuss & Give brief description about string class methods
Java string methods
Plz answer - Java BeginnersPlz answer Create a Java Bean Class â?? Customer according to the below given class diagram.
Customer...
-------------------------------------------------
plz doreply me....thankz alot
plz answer - Java Beginnersplz answer Write a Binary Search program that searches an array of ordered data. Compose an ordered array of 500 integers that contains the following series of numbers and run the search on it:
1, 2, 3, 5, 8, 13, 21, 34, 55
Plz send me answer qucklyPlz send me
answer quckly Respected Sir,
myself is pavan shrivastava.i want ask a question that is ( we can't
create object of interface then how would possible to create object
to know my answerto know
my answer hi,
this is pinki, i can't solve
my question "how to change rupee to dollar,pound and viceversa using wrapper class in java." will u help me
plz solve my query?plz solve
my query? how to remove all the options from select control in html using java script?
JavaScript remove all items
<html>
<script language="javascript" >
function removeAllItems(selectbox
need the answer vry urgently..plz help me...[plzzzzzzzzneed the
answer vry urgently..
plz help me...[plzzzzzzzz the question... code...hpw to write in eclipse platform....
plz plz mail me...to panda.pragnya7@gmail.com/panda_pragnya@yahoo.com...
plz plz...help....me..it can change
my lyfe
how the answer is 13 can anyone explain plzhow the
answer is 13 can anyone explain plz public class that {
public static void main(String arr[])
{
int i=3;
int j=1;
while(i<4)
{
//j=i;
i=i+j/2;
}
System.out.println(i
QuesQues
plz plz give coding for
C
CO
COM
COMP
COMPU
COMPUT
COMPUTE... {
public static void main(String[] args) {
int num=3;
int p = num;
int
q = 0...;=
q; k++)
System.out.print(" ");
q+=1;
}
}
}
Thanks
plz anyone can solve myplz anyone can solve my creat an applet prog which accepts the details of 10 customers like name , address , city , ect. and display it
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import
Clarify my last question's answer - Java BeginnersClarify
my last question's answer Dear expert,
I've tried out... did not specify
my question too clearly.
Here's
my 2 database... and parents contain other fields like name, address, email, contact numbers etc.
My provide me the program for that ques.provide me the program for that
ques. wtite a program in java there is a class readchar.the functionality of this class is to read a string from the console and display the characters of that string on the console.
give the code for this ques///give the code for this
ques/// write a program in java in which there is a clss readline. the functionality of this class is to read a string from the console and display it on the console .A point that should be keep in mind
give the code for this ques///give the code for this
ques/// write a program in java which contains a class simple. this class contains 4 members variables namely a,b,c,and d. This class also contains 3 constructors of 2,3 and 4 arguments and a function
answer it soonanswer it soon write a proggram to accept a number and check whether the sum of prime factors of a number is a prime number
ModuleNotFoundError: No module named 'answer'ModuleNotFoundError: No module named '
answer' Hi,
My Python... '
answer'
How to remove the ModuleNotFoundError: No module named '
answer'... to install padas library.
You can install
answer python with following command
ModuleNotFoundError: No module named 'answer'ModuleNotFoundError: No module named '
answer' Hi,
My Python... '
answer'
How to remove the ModuleNotFoundError: No module named '
answer'... to install padas library.
You can install
answer python with following command
ModuleNotFoundError: No module named 'answer'ModuleNotFoundError: No module named '
answer' Hi,
My Python... '
answer'
How to remove the ModuleNotFoundError: No module named '
answer'... to install padas library.
You can install
answer python with following command
java.please answer this...java.please
answer this... Q1).How we can write a complete JAVA program that computes the following summation formulas..?
â??_(i=1)^nâ??ã??i^2=ã?? (n^(2 ) ã??(n+1)ã??^2)/4
plz helpplz help what is the procedure and code to design an interactive GUI in java using swings
ModuleNotFoundError: No module named 'plz'ModuleNotFoundError: No module named '
plz' Hi,
My Python program is throwing following error:
ModuleNotFoundError: No module named '
plz'
How to remove the ModuleNotFoundError: No module named '
plz' error
ModuleNotFoundError: No module named 'plz'ModuleNotFoundError: No module named '
plz' Hi,
My Python program is throwing following error:
ModuleNotFoundError: No module named '
plz'
How to remove the ModuleNotFoundError: No module named '
plz' error
Plz HelpPlz Help Hello Guys!!
Plz. Help
I need to write a program to display the astrological sign based on your birthday for example
If we enter the date of birth in the following format from console--13/08/1990
it should give you
about interview ques. - Java Interview Questionsabout interview
ques. i give a interview for java..
they ask me.
what is System.out.println();
what is its write ans... Hi Friend,
It is the syntax of Java used to display a string on the console window
Answer for SCJP Module-1 Question-13Answer for SCJP Module-1 Question-13 The
Answer for SCJP Module-1 Question-13 is missing , I think the
answer is option '1', Correct me if I am wrong
ans plz));
}
}
}
Thanks
Post
Answer Urgent Answer ReqUrgent
Answer Req how to view the file content which is at client side from jsp in java
Is the answer 35, 35?Is the
answer 35, 35? int a = 5;
int b = 7;
int num = 35;
while (a < b)
{
System.out.println(?
My age is ? + num);
a = a + 1;
}
...) {
System.out.println("?
My age is ? "+ num);
a = a + 1
please answer meplease
answer me iam using html in select tag.in this one option i selected and that option data will be display in table.And use servlet with html and how to retrieve the data from data base
Please give me the answer."int a=08 or 09" its giving compile time error why "int a=08 or 09" its giving compile time error why ?
can any one give me the
answer of this please
ModuleNotFoundError: No module named 'plz-cmd'ModuleNotFoundError: No module named '
plz-cmd' Hi,
My Python program is throwing following error:
ModuleNotFoundError: No module named '
plz-cmd'
How to remove the ModuleNotFoundError: No module named '
plz-cmd
ModuleNotFoundError: No module named 'pretty-plz'ModuleNotFoundError: No module named 'pretty-
plz' Hi,
My Python... 'pretty-
plz'
How to remove the ModuleNotFoundError: No module named 'pretty-
plz' error?
Thanks
Hi,
In your python environment you