Home Answers Viewqa Java-Beginners plz. answer my ques

 
 


ompal chahar
plz. answer my ques
4 Answer(s)      4 years and 10 months ago
Posted in : Java Beginners

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 Pages:
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
Ques
Ques  plz plz give coding for C CO COM COMP COMPU COMPUT COMPUTE COMPUTER & wap to print product of digits (212=212) &wap to compute sum of 1^2+2^2+4^2+8^2+10^2 . coding
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
plz give me answer plz  writw a programme to find rank from an array using doubledimmensionalarray
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 panda.pragnya7@gmail.com/panda_pragnya@yahoo.com...plz plz...help....me..it can change my lyfe
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
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 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
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
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
ans plz
)); } } } Thanks Post Answer
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
Can u Look to the error plz - Java Beginners
Can u Look to the error plz  this is my code can u modify it plz and give me the result of it when u check it on eclipse or jcreator plz and i...;where is the answer sir.? just i want from you to look what is the error plz
help me plz - Java Interview Questions
? plz answer my question   Hi Friend, Try the following code: 1
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
Login Box appears at the background of my webpage?
Login Box appears at the background of my webpage?   As per the answer regarding my earlier query, when I post the code in my HTML page, the Login Box appears at the background of my HTMl page...........I tried CSS to change its
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
my assignment
...this is my assignment....plz...my assignment  as programmer, you have been assigned to develop a user interface for a fats food ordering system.the interface should have various
ArrayList question plz solve it
ArrayList question plz solve it  An arraylist object stores an Emp Object, where there is name,age,address of the employee is stored, And i want to access the data in the basis of age based? Provide answer to the question
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.   
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
plz help - Java Beginners
plz help  i have to programs and it takes too long to run them so i got a solution that makes programs run much faster which is threading programming.. but i dont know how to aplly that on my 2 programs: the first code
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 Help me - Java Beginners
plz Help me  Hi, I want learn struts,I dont have any idea about this plz help how can i make a framework.If u have any information then plz send my personal id plz tell me that whose software installed.and give me brief
plz send immediately - Java Beginners
plz send immediately  Hi Deepak, How are you, Deepak I face some problem in my project,plz help me My Questin is user input... should be updated. plz write a code and immediate response its very urgent plz
plz help me - Java Beginners
plz help me  Thanks deepak continue response..i face some problem i... admin page this is my web.xml file i m declaring in the session tag is true...but i very confuse that how it is not displayed admin page plz any one
my question is related to my project viz
my question is related to my project viz   Sir, my project is based on MR tracking system developed using struts framework, it has been developed.... plz help me
help plz - Java Interview Questions
/ output the number of milk cartons needed to hold milk (round your answer... , if the input string is abcd, the output is : edcba plz plz plz plz plz help
plz help me!!!!!!!! - JSP-Servlet
plz help me!!!!!!!!  i`ve set the environment varaibles for tomcat as well as jdk.. but i`m not understanding where i`ve to save my servlet..i.e.... there are compilation errors.. plz do help me.   make sure that you did
i need help plz .... Quickly
i need help plz .... Quickly   how can i count how many numbers enterd by the user so the output would be like this Total number of Scores = .... this is my code :- import java.util.Scanner; public class SCORES { public
sir plz send the project on quiz system code
sir plz send the project on quiz system code  sir plz send the client server based project in core java database in my sql
help plz - Java Interview Questions
help plz   1 )write a program that does the following : a. prompts the user to input five decimal numbers representing the scores? b. prints.../ output the number of milk cartons needed to hold milk (round your answer
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
Download.jsp Urgent plz - JSP-Servlet
in my database.. Only the file name are present in my database which has been... me immediately.. This is my kind request to whole Roseindia team.. Thanks
Help me plz in Probablity distribution of Java
Help me plz in Probablity distribution of Java  Hello, I have an issue I have connected my JDBC driver with my database.. Now I want to randomly generate transactions with my db such that 0.7% is select query and 0.3
OCI Connectivity For Oracle Plz Solve This Error
OCI Connectivity For Oracle Plz Solve This Error  import java.io....) { e.printStackTrace(); } } } ---> I found Error below how i can solve this error plz tell me some answer Package not found Error
OCI Connectivity For Oracle Plz Solve This Error
OCI Connectivity For Oracle Plz Solve This Error  import java.io....) { e.printStackTrace(); } } } ---> I found Error below how i can solve this error plz tell me some answer Package not found Error
Plz chk it and reply again - Java Beginners
will be slow also. so plz help me for this if u understood my question then plz...Plz chk it and reply again  Hi Deepak, Thanks for fast reply,your application is good,u write this code for user click the view database