Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet jsp login code ... when username , drop down box and password is correct

Have Programming Question? Ask it here!
 
 
 


Abinesh
jsp login code ... when username , drop down box and password is correct
2 Answer(s)      2 years and 5 months ago
Posted in : JSP-Servlet


i need a jsp code for login.... when username password and dropdown box value is correct.... the drop down box values should be retrieved from database..... please provede me codes for that..... thnk u


Advertisement
View Answers

April 4, 2012 at 3:25 PM


1)login.jsp:

<html>
<script>
function validate(){
var username=document.form.user.value;
var password=document.form.pass.value;
if(username==""){
 alert("Enter Username!");
  return false;
}
if(password==""){
 alert("Enter Password!");
  return false;
}
return true;
}
</script>
<form name="form" method="post" action="check.jsp" onsubmit="javascript:return validate();">
<table>
<tr><td>Username:</td><td><input type="text" name="user"></td></tr>
<tr><td>Password:</td><td><input type="password" name="pass"></td></tr>
<tr><td>Select Company: </td><td>
<select name="com">
<%
Class.forName("com.mysql.jdbc.Driver").newInstance();
    Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root");  
           Statement st=con.createStatement();
           ResultSet rs=st.executeQuery("select * from login");
           while(rs.next()){
           %>

<option value="<%=rs.getString("company")%>"><%=rs.getString("company")%></option>
<%
           }
%>
</select>
</td></tr>
<tr><td></td><td><input type="submit" value="Login"></td></tr>
</table>
</form>
</html>

2)check.jsp:

<%@page import="java.sql.*"%>
<%
try{
String user=request.getParameter("user");
String pass=request.getParameter("pass");
String com=request.getParameter("com");
 Class.forName("com.mysql.jdbc.Driver").newInstance();
    Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root");  
           Statement st=con.createStatement();
           ResultSet rs=st.executeQuery("select * from login where username='"+user+"' and password='"+pass+"'and company='"+com+"'");
           int count=0;
           while(rs.next()){
           count++;
          }
          if(count>0){
           out.println("welcome "+user);
           }
          else{
           response.sendRedirect("login.jsp");
          }
        }
    catch(Exception e){
    System.out.println(e);
}
%>


April 5, 2012 at 7:03 PM


thank u... the half..i.e the first program works.... the value is retrieved from database into combo box..... but the validation is not happening..... the all three username , passwrod and company name are corect but its showing as wrong..... i dont know how to check the combo box selected value.... pls help me.... thnx



Related Tutorials/Questions & Answers:
jsp login code ... when username , drop down box and password is correct
jsp login code ... when username , drop down box and password is correct  i need a jsp code for login.... when username password and dropdown box value is correct.... the drop down box values should be retrieved from database
jsp login code when username , password and dropdown box value is correct...
jsp login code when username , password and dropdown box value is correct... in dropdown box.... so when i login i all the three username,password and dropdown box........ but in the drop down box ... i need to get the values from backend
Advertisements
jsp login code when username , password and dropdown box value is correct...
jsp login code when username , password and dropdown box value is correct... in dropdown box.... so when i login i all the three username,password and dropdown box...=document.form.user.value; var password=document.form.pass.value; if(username==""){ alert("Enter
jsp code for a drop down box to retrive value from database
jsp code for a drop down box to retrive value from database  my project needs to get the value from database in to the drop down box..... pls give me... login where username='"+user+"' and password='"+pass+"'and company='"+com
drop down box - JSP-Servlet
drop down box  when i enter some letter in the input box,the corresponding words of that particular letter must be displayed below as a list from the data base in the same input box as drop down. Thanks&Regards, VijayaBabu.M
Login With Drop Down
Login With Drop Down   Hi all, I am doing a project using JSP. My... box and then login to the page. I have a drop down list box with Customs... by selecting the drop down box. Suppose the Customs username is 1001 and Accounts
dependent drop down box - JSP-Servlet
dependent drop down box  haloo sir Please give me the solution how to extract data from dependent drop down box with page refresh... saroj  Hi Friend, Try the following code
Login With Drop Down, Having Departments in different table
is to select the department from the drop down box and then login to the page. I have a drop down list box with Customs and Accounts..A Username and a Password field.Now want to login to the page by selecting the drop down box. Suppose
Drop Down Box
Drop Down Box  In a Drop Down box I want to show the user All the Country In the World. And when he type A-z,then each of the type Show those country which start with those word. Like I For-India
retrive the data from access database to drop down list box in jsp
retrive the data from access database to drop down list box in jsp  hai, im new to jsp now im using the jsp along with access database.in table i load all the data's i need to retrive the data from database to dropdown list box
simple code to write an read and write the login detail to a xml file using javascript ( username and password )
simple code to write an read and write the login detail to a xml file using javascript ( username and password )  pls can nyone give me a code to write and read the login details (username and password )into a xml file using
store values of drop down list box in database
store values of drop down list box in database  how to store values of drop down list box in oracle database in jsp?I have information inserting form where i have date of birth as drop down list box
dynamic drop down list box - Java Beginners
dynamic drop down list box  hi all , I want to dynamically populate a drop down box from an sql query in a servlet program, using only html... = "com.mysql.jdbc.Driver"; String userName ="amar"; String password
How to Display Username After Login in JSP
How to Display Username After Login in JSP In this section we will discuss how to display the Username and password after the successful login. In JSP... page in which username and password is created. So, when you submit the details
Pls provide me jsp code to get values in drop down list from another table's field....
Pls provide me jsp code to get values in drop down list from another table's... in customer registration page and should be shown in drop down box in front end... pages..... when i insert data in company registration .. it ll have company id
sir plz help in design a jsp page whichis as follow username [_____] select [__>]password [_____] after selection then onlypassword text box is visible
sir plz help in design a jsp page   sir plz help in design a jsp page which is as follow username [ _ ] select [ > ] password [ _ ] after selection then only password text box is visible
validating username and password in servlet and redirect to login page with error message if not valid
validating username and password in servlet and redirect to login page with error message if not valid  hi i want to validate my login page username... error message saying "Invalid username and password" in my login page. please help
JSP Dependent Drop Down Menu
JSP Dependent Drop Down Menu  Hey Guy/Gals! I need someone help to guide me in creating a drop down menu, where the first menu affects the second...; The given code will help you to create a dependent dropdown box. 1
jsp drop down without refresh - JSP-Servlet
jsp drop down without refresh  Sir I have tried two depenedent jsp dropdown in jsp page,But the probleam is when i select first drop down its... jsp same probleam also arise. Please tell me how to use the drop down without
how to import values from database to the drop down box
employee page i kept a drop down box for employee Ids i want all employee IDs will display in the drop down box please help me with the code...how to import values from database to the drop down box   hi iam
jsp drop down-- select Option
jsp drop down-- select Option  how to get drop down populated...) in database and try the following code: <%@page import="java.sql.*"%> <html>... want the code in ajax then try the following code: 1)country.jsp: <%@page
Username password
=st.executeQuery("select * from login where username='"+value1+"' and password='"+value2... with the validation, so that if the username and password match it will continue... that checks whether the username and password is valid or not. If the user
display table details when selecting table name in drop down liat
display table details when selecting table name in drop down liat  Hello, Am having problem in my project... i want to retrive the data from mysql database to the dropdownlist in jsp. Example: 1st i want to display the list
Login Box appears when a button on the webpage is clicked
Login Box appears when a button on the webpage is clicked  How to create a Login Box on a web page that appears only when a button that is already present on the page is clicked
Login Box appears when a button on the webpage is clicked
Login Box appears when a button on the webpage is clicked  How to create a Login Box on a web page that appears only when a button that is already present on the page is clicked
Login Box appears when a button on the webpage is clicked
Login Box appears when a button on the webpage is clicked  How to create a Login Box on a web page that appears only when a button that is already present on the page is clicked
to update drop down list value when selected from website
to update drop down list value when selected from website  hi help me, i want to insert value into db when i select from a drop down list, this is my code, <div id="age"> Age <select name='NEW'> <option
to update drop down list value when selected from website
to update drop down list value when selected from website  hi help me, i want to insert value into db when i select from a drop down list, this is my code, <div id="age"> Age <select name='NEW'> <option
to update drop down list value when selected from website
to update drop down list value when selected from website  hi help me, i want to insert value into db when i select from a drop down list, this is my code, <div id="age"> Age <select name='NEW'> <option
to access value of drop down value in beans when dropdown is populated using ajax
to access value of drop down value in beans when dropdown is populated using ajax  i want to access value of dropdown box in beans .. and this drop down was filled using ajax. plz help
Drop-down text selection in jsp/html
Drop-down text selection in jsp/html  Hi, I am trying to create JSP page where I have two drop-downs. There are two-sets of data - First set.... Now the first dropdown will have all the values. The second drop-down depends upon
how to check username & password from database using jsp
how to check username & password from database using jsp  Hello, I have created 1 html page which contain username, password & submit button.... name is amit and password is ddave. so hw could i check whether the username
Get values in drop down list
Get values in drop down list  Pls provide me jsp code to get values in drop down list from another table's field. my project has customer... in drop down box in front end..... pls provide me code.. thanx
insert data using drop down box in java into database postgresql
insert data using drop down box in java into database postgresql  can... data into database using an drop down box .....as i m using eclipse as jdbc...); } } } **HTML code of it:-** <html xmlns:wicket="..."> <
insert data using drop down box in java into database postgresql
insert data using drop down box in java into database postgresql  can... data into database using an drop down box .....as i m using eclipse as jdbc...); } } } **HTML code of it:-** <html xmlns:wicket="..."> <
insert data using drop down box in java into database postgresql
insert data using drop down box in java into database postgresql  can... data into database using an drop down box .....as i m using eclipse as jdbc...); } } } **HTML code of it:-** <html xmlns:wicket="..."> <
insert data using drop down box in java into database postgresql
insert data using drop down box in java into database postgresql  can... data into database using an drop down box .....as i m using eclipse as jdbc...); } } } **HTML code of it:-** <html xmlns:wicket="..."> <
JSP code for forget password
JSP code for forget password  I need forget password JSP code.. example http://www.roseindia.net/users/forgotpassword.html
forgot password code in jsp
forgot password code in jsp  forgot password code in jsp   Please visit the following link: http://www.roseindia.net/jsf/richfaces
drop down
drop down  how can i add data from choice/dropdown component of java awt to myaql table
Drop Down
Drop Down  How to insert date into database using dropdown like facebook
HTML Login Page Code
enters the correct username and password, it will not Login. Once you enter the correct Username and Password, you will be redirected to another page... JavaScript validation in Login page. We have set username and password value
displaying section in the jsp based on the sected value in drop down - Java Beginners
displaying section in the jsp based on the sected value in drop down   Hi friend, i have one problem in my jsp. i.e i have to display section on the jsp based on the selected value in the drop down list using java script code
Drop Down reload in IE
Drop Down reload in IE  Hi i was using two drop down box..One for Displaying date followed by another for Dispalying Month..If i Select/Change Month from the 2nd drop down then the 1st drop down ( which is date) automatically
drop down menu
drop down menu  drop down menu using html
The code for retrieving data from database into Drop Down List.
The code for retrieving data from database into Drop Down List.  <...;% } %> // my code for displaying quantity is below but its now working.I am new to jsp, so dont know how to populate the textbox
dynamic drop down list
dynamic drop down list  I want to create 2 drop down list, where it takes value from database and the two list are dependent..means if I select... on the value chosen from the previous. want code in javascript and jsp, Can you help
code to validate username password of gmail and procedures to establish jdbc connectivity to store unread mails and retreive it..
, 1)I am in need of code to establish username and password of gmail 2)code in jsp to validate the username and password of my gmail mentioned above...code to validate username password of gmail and procedures to establish jdbc
code to validate username password of gmail and procedures to establish jdbc connectivity to store unread mails and retreive it..
, 1)I am in need of code to establish username and password of gmail 2)code in jsp to validate the username and password of my gmail mentioned above...code to validate username password of gmail and procedures to establish jdbc
code to validate username password of gmail and procedures to establish jdbc connectivity to store unread mails and retreive it..
, 1)I am in need of code to establish username and password of gmail 2)code in jsp to validate the username and password of my gmail mentioned above...code to validate username password of gmail and procedures to establish jdbc
 

 

 

DMCA.com