plz. answer my ques

Ads
 

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"

Ads









Related Tutorials/Questions & Answers:
plz give me answer plz
plz give me answer plz  writw a programme to find rank from an array using doubledimmensionalarray
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
Advertisements
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 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
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
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
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
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
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
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
answer
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
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

Ads