Home Answers Viewqa JDBC Jdbc Login Page Validation using Combobox

 
 


Manjunath.Surpur
Jdbc Login Page Validation using Combobox
1 Answer(s)      a year and 10 months ago
Posted in : JDBC

I am beginer to java i am able to validate username and password but unable to get validate the username and password with combo box....please help me I want to validate username and password for diffrent cities diffrent types of username and password.....please help me to validate username and password by using combo box..... Please Help Me....

Thanks alot

Index.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Celcabs Login Page</title>
<link href="css/DBLogin.css" type="text/css" rel="stylesheet"></link>
<script language="javascript">
<!--//
/*This Script allows people to enter by using a form that asks for a
UserID and Password*/
function pasuser(form) {
if (form.id.value=="agni") {
if (form.pass.value=="ihafuf") {
location="Menu.jsp"
} else {
alert("Invalid Password")
}
} else { alert("Invalid UserID")
}
}
//-->
</script>
</head>
<body bgcolor="#DCDCDC">
<h2 align="center">Celcabs UserLogin </h2> <hr>
<form action="authenticateUserServlet" method="POST">
<table>
<tr><td align="left">Username</td><td><input type="text" name="username" size="20"></td></tr>
<tr><td align="left">Password:</td><td><input type="password" name="password" size="20"></td></tr>
<tr><td align="left">Terminal:</td><td><select style=width:180px>
*****<option value="Mumbai">Mumbai</option><option value="hma">Hma</option>
<option value="Bangalore">Bangalore</option>
<option value="Pune">Pune</option>
<option value="Chennai">Chennai</option><option value="Hydrabad">Hydrabad</option>*****
</select></td></tr>
<tr><td colspan="2"><input type="submit" value="Login"><input type="reset" Value="Cancel" ></input></td></tr>
</table>
</form>
</body></html>

servlets:-
package myservlets;
import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class authenticateUserServlet extends HttpServlet {
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
        }

protected void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {

response.setContentType("text/html");
PrintWriter pw = response.getWriter();
String name = request.getParameter("username");
String password = request.getParameter("password");

try{
String driver = "org.postgresql.Driver";
Class.forName(driver).newInstance();

Connection con=null;
Statement stmt=null;

String url="jdbc:postgresql://192.168.10.32/blrtaxi";
con=DriverManager.getConnection("jdbc:postgresql://localhost:5432/manju","postgres", "password");
stmt=con.createStatement();
String query = "select uname,password from dblogin where uname='"+name+"' and password='"+password+"'";
System.out.println(query);
ResultSet rs = stmt.executeQuery(query);

if(rs.next()){

response.sendRedirect("Menu.jsp");
}
else{
    response.sendRedirect("index.jsp");
}
}

catch(Exception e){
System.out.println(e.getMessage());
}
}
}

Thanks and Regards Manjunath Surpur

View Answers

July 25, 2011 at 3:49 PM


Please go through the following link:

http://www.roseindia.net/jsp/loginbean.shtml









Related Pages:
Jdbc Login Page Validation using Combobox
Jdbc Login Page Validation using Combobox  I got Login By this code i want to login by validating with combobox....The link which you send its...(e.getMessage()); } } } I want login username,password and combobox By sessions
Jdbc Login Page Validation using Combobox
Jdbc Login Page Validation using Combobox  I am beginer to java i am... help me to validate username and password by using combo box..... Please Help Me.... Thanks alot Index.jsp <%@ page language="java" contentType="text
Jdbc Login Page Validation using Combobox
Jdbc Login Page Validation using Combobox  I am beginer to java i am... help me to validate username and password by using combo box..... Please Help Me.... Thanks alot Index.jsp <%@ page language="java" contentType="text
Login page validation on ipad
Login page validation on ipad  I am using userId & password labels and their corresponding textfield. Now I want to validate the details by single sign in button and want to switch on to next page. Used two labels again
comboBox validation
comboBox validation  dear sir. i want to know . how to validate radio button in struts using xml validation. thanks
combobox
;%@page import="java.sql.*"%> <html> <head> <script type="text...("jdbc:mysql://localhost:3306/test", "root", "root"); Statement st...;/body> </html> 2)getdata.jsp: <%@ page import="java.sql.*" %>
combobox
help me sir <%@page import="java.sql.*" %> <html> <head>... =DriverManager.getConnection("jdbc:odbc:neha"); PreparedStatement stat,yu
combobox
help me sir <%@page import="java.sql.*" %> <html> <head>... =DriverManager.getConnection("jdbc:odbc:neha"); PreparedStatement stat,yu
LOGIN PROBLEM - JDBC
values and special charecters etc, on the data entered. - Using JDBC create... - After submitting the User ID and Password in the login page, forward the control... and special charecters etc, on the data entered. - Using JDBC create a connection
Login validation doubt
Login validation doubt  Hi, 1)login.jsp: <%@page import...;% } %> 2)check.jsp: <%@page import="java.sql.*"%> <% String user... = DriverManager.getConnection("jdbc:odbc:student"); Statement st=con.createStatement
login page
login page  hi i'm trying to create login page using jsp. i get no error while compiling but i get 404 while running the index.jsp. And i'm using... the program. Following are my programs... 1.index.jsp <%@page contentType="text
login page validation
login page validation  hi could you please send me code for login validations Email validation and password email should be in correct format and valid password in java   import java.awt.*; import javax.swing.
JSP-jdbc validation - JSP-Servlet
JSP-jdbc validation  How to validate login email id using JSP, where...; } login page..., login application in jsp function validateForm(theForm
struts2.2.1 Login validation example.
struts2.2.1 Login validation example. In this example, We will discuss about the Login validation using struts2.2.1. Directory structure of example...; charset=UTF-8"> <title>Login Validation Example<
jsp-oracle validation - JDBC
; } login page User Name...jsp-oracle validation  Dear friends, my validation not takes place... ----------------------------------- loginsuccess.jsp Logout Success login
html login page with ajax
html login page with ajax  hi all... i want to create a login page using html and ajax for validation is must. please help me doing that with code... and password from the user and check whether the user is valid or not by using ajax
login page
login page  pls say how to create a login page in jsp and mysql using netbaens   Hi Friend, Please visit the following links: http://roseindia.net/jsf/netbeans/index.shtml http://roseindia.net/jsp/loginbean.shtml
login
login  how to create login page in jsp   Here is a jsp code that creates the login page and check whether the user is valid or not. 1...;tr><td></td><td><input type="submit" value="Login">
login
loggedinto next page   Hi Friend, Try the following code: 1... java.awt.event.*; class Login { JButton SUBMIT; JLabel label1,label2; final JTextField text1,text2; Login() { final JFrame f=new JFrame("Login Form
combobox
combobox  actually sir code u send me doesnt work propely using jsp-ajax only country is selected bt state does nt show in table
login form validation - JSP-Servlet
login form validation  hi, how to validate the login form that contains user name and password using post method . the validation should not allow user to login in the address bar thanks regards, anand
Validation
). How do i perform a check using JAVA on the data before storing...(); Connection conn = DriverManager.getConnection("jdbc:mysql://localhost
validation
form using spring ,hibernate and jsp my all classes and jsp pages are pasted... file its very usefull me,,, i am new no spring. userFormjsp <%@ page...; } Registration Page <table> <tr> <
jsp combobox
..if i select one country throug combo box than other combobox show state only...)country.jsp: <%@page import="java.sql.*"%> <html> <head>...").newInstance(); Connection con = DriverManager.getConnection("jdbc:mysql
login page with mysql using jsp
login page with mysql using jsp  pls i need a sample of login page to check username and password in mysql database. thanks
Login Password Validation iPhone / iPAD
Login Password Validation iPhone / iPAD  HOW TO WRITE A TEST CASE TO SET THE VALIDATION FOR LOGIN AND PASSWORD FIELD IN OBJECTIVE C, IOS.   ...]; //unless you're using ARC } @end   WHAT IS "STAssertTrue
ComboBox in Flex4
provide the data to the Combobox control by using the DataProvider Property...ComboBox in Flex4: In Flex4 Combobox is called a spark Combobox control. DropDownListBase control is the base class of the combobox control. Combobox
String Validation
String Validation changing password  Hi. I have a HTML coding...)changePassword.jsp <%@page import="java.sql.*"%> <%@page import="java.io...."); String connectionURL = "jdbc:mysql://localhost:3306/test"; Connection con=null
JSF Validation In Login Application
<%@ page contentType="text/html"%> <%@ taglib uri="...:view> <html> <head><title>JSF Simple Login Example<...;td><h:outputText value="Enter Login ID: " /></td> <
user validation
my final yr project in jsp.i m doin the login page & m stuck with a problem in validating the user.the code i hv written below doesnt redirect to the login page if username & password is invalid but it does redirect only
String Validation
;%@page import="java.sql.*"%> <%@page import="java.io.*"%> <% String... connectionURL = "jdbc:mysql://localhost:3306/test"; Connection con=null; String pass=""; int...(); ResultSet rs=st.executeQuery("select * from login where password='"+currentPassword
String Validation
;%@page import="java.sql.*"%> <%@page import="java.io.*"%> <% String... connectionURL = "jdbc:mysql://localhost:3306/test"; Connection con=null; String pass=""; int...(); ResultSet rs=st.executeQuery("select * from login where password='"+currentPassword
Password validation
;/html> 2)changePassword.jsp <%@page import="java.sql.*"%> <%@page import...("confirm"); String connectionURL = "jdbc:mysql://localhost:3306/test... st=con.createStatement(); ResultSet rs=st.executeQuery("select * from login where
Password validation
;/html> 2)changePassword.jsp <%@page import="java.sql.*"%> <%@page import...("confirm"); String connectionURL = "jdbc:mysql://localhost:3306/test... st=con.createStatement(); ResultSet rs=st.executeQuery("select * from login where
Password validation
;/html> 2)changePassword.jsp <%@page import="java.sql.*"%> <%@page import...("confirm"); String connectionURL = "jdbc:mysql://localhost:3306/test... st=con.createStatement(); ResultSet rs=st.executeQuery("select * from login where
Password validation
;/html> 2)changePassword.jsp <%@page import="java.sql.*"%> <%@page import...("confirm"); String connectionURL = "jdbc:mysql://localhost:3306/test... st=con.createStatement(); ResultSet rs=st.executeQuery("select * from login where
Password validation
; </table> </form> </html> 2)changePassword.jsp <%@page import="java.sql.*"%> <%@page import="java.io.*"%> <% String..."); String conpass=request.getParameter("confirm"); String connectionURL = "jdbc
String Validation
)changePassword.jsp <%@page import="java.sql.*"%> <%@page import="java.io.*"%> <... connectionURL = "jdbc:mysql://localhost:3306/test"; Connection con=null; String...(); ResultSet rs=st.executeQuery("select * from login where password
login page code in asp.net
login page code in asp.net  i need front end and backend code for login page in vb asp.net using sql server....having code for submit button
login form
login form  sir my next form consists logout button when i click on it it showing login form but next form window is not closing but the components prepsent in that form are getting clearedup using frameobject.setVisible(false
jsp login page
jsp login page  hi tell me how to create a login page using jsp and servlet and not using bean... please tell how to create a database in sql server... please tell with code
login form
login form  sir my next form consists logout button when i click on it it showing login form but next form window is not closing but the components prepsent in that form are getting clearedup using frameobject.setVisible(false
program code for login page in struts by using eclipse
program code for login page in struts by using eclipse  I want program code for login page in struts by using eclipse
login page - Java Beginners
login page  I have one login page in jsp that is login.jsp. Now i have validate user from database by another page validate.jsp. but if the user feeded wrong information then i want to print error massege on the first page
Example of login form validation in struts2.2.1framework.
Example of login form validation in struts2.2.1 framework. In this example, we will introduce you to about the login form validation in struts2.2.1 framework. Our login form validation example does not validate the user against
login page with image
login page with image  I am writing program for login page.It consists of a image and the login details... how to write a java program using frames that have the default positions in any of the systems.. thanks   i had
jsp login page
jsp login page  Hi All, can any one tell me how to create Login page using JSP and Beans. A simple log in page. Please reply ASAP. Thanx, am2085   Hello Friend, Please visit the following link: JSP Login Using
HTML login page code
HTML login page code  Hi all, I am writing my first HTML JavaScrip validation page called "UserLogin.html". So, please guide me how to validate user... the complete HTML JavaScript code for User Login Page. Thanks in Advance!   
Registration page with JavaScript Validation
Registration page with JavaScript Validation   HTML Registration page with JavaScript Validation - required source code   Registration page in HTML with JavaScript Validation source code <html> <head>
Controling login - JDBC
to controlling the userid and password matches or not iam using oracle database... = "XE"; String url = "jdbc:oracle:thin:@" + serverName...){ System.err.println("Could not load JDBC driver"); System.out.println("Exception

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.