plz. answer my ques

plz. answer my ques

View Answers

August 24, 2008 at 8:42 PM

can you mention technology in which u want to do i mean for view or it simple console based.

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");
}
}
}

August 25, 2008 at 5:13 PM

1) first create "retry.jsp" page (this displays login details)
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
</head>
<body>
<form action = "validate.jsp" method = "post">
<p>Username <input type="text" name="userName"/>
<p>Password <input type="password" name="passWord"/>
<input type="submit" value="Login" />
</form>
</body>
</html>


2) and then create "validate.jsp" page
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
<base href="<%=basePath%>">
<body>
<%
String userName = request.getParameter ("userName");
String passWord = request.getParameter("passWord");
%>
<%= userName%><br/>
<%= passWord%><br/>
</head>
</body>
</html>

finally deploy this in the server and run the application
when u enter the username and password it will be displayed in the next page
note: please dont follow the above link because its for different logic
with regards
Fahid

August 25, 2008 at 5:16 PM

i mean dont follow the first logic which was given by me just follow 2nd logic which contains two jsp fils "retry.jsp and validate.jsp"









Related Tutorials/Questions & Answers:
plz. answer my ques - Java Beginners
plz. 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 plz
plz give me answer plz  writw a programme to find rank from an array using doubledimmensionalarray
Advertisements
my answer
my 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 answer
plz give me answer   description about string class methods   Java string methods
plz give me answer
plz give me answer   description about string class methods   Java string methods
plz give me answer
plz give me answer   description about string class methods   Java string methods
plz give me answer
plz give me answer  Discuss & Give brief description about string class methods   Java string methods
Plz answer - Java Beginners
Plz answer  Create a Java Bean Class â?? Customer according to the below given class diagram. Customer... ------------------------------------------------- plz doreply me....thankz alot  
plz answer - Java Beginners
plz 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 quckly
Plz 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 answer
to 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...[plzzzzzzzz
need the answer vry urgently..plz help me...[plzzzzzzzz  the question... code...hpw to write in eclipse platform....plz plz mail me...to [email protected]/[email protected]...plz plz...help....me..it can change my lyfe
how the answer is 13 can anyone explain plz
how 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
Ques
Ques  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 my
plz 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 Beginners
Clarify 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
plz try to clear my doubt for shuffling multi-dimensional array
plz try to clear my doubt for shuffling multi-dimensional array  hi, if v r using Arrays.asList() means, it may shuffle the row wise list only... v...??? plz help me... thanks in advance   Hi Friend, Try the following code
sir plz do respond to my problem immediately - Java Beginners
sir plz do respond to my problem immediately  Hello sir, Iam very happy that you have responded to my problem.The code u sent... code(sent by you).plz inject that code into my browser code so that it can show
plz check my codings are correct or not...There is an error..i cant find it..
plz check my codings are correct or not...There is an error..i cant find it..  import java.util.Scanner; public class Student { private String indexNo; private String gender; private char initial; private int mark1
Ques
how can i add wirecard option(or button ) at my web page plz tell all steps? View Answers
how can i add wirecard option(or button ) at my web page plz tell all steps? View Answers  how can i add wirecard option(or button ) at my web page plz tell all steps? View Answers
i want to find the byte code of a image file ... for my project..plz if anybody help me for java coding i will grateful..
i want to find the byte code of a image file ... for my project..plz if anybody... a image file to its byte code format that help me for the pattern matching in my project.. but i cant convert Image file to its byte code format.. if anybody can plz
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
i have an ques. of advanced java
i have an ques. of advanced java  write a wap to implement AWT by login form
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
plz plz plz inform me as soon as possible
plz plz plz inform me as soon as possible  ``by using c programs how to type
answer it soon
answer 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
answer
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 help
plz 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 Help
Plz 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
plz plz rply as soon as possible
plz plz rply as soon as possible  by using c programs * * * * * s s s s s * s s o s s s s s s s s s s s s s s s s s s s s s s s
about interview ques. - Java Interview Questions
about 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
String Ques
Answer for SCJP Module-1 Question-13
Answer 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
pls answer the Trangle pattern
pls answer the Trangle pattern    a b c d e b c d e c d e d e e Please answer and give the code for above triangle
Urgent Answer Req
Urgent 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 me
please 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

Ads