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



Home Answers Viewqa JSP-Servlet jsp login code when username , password and dropdown box value is correct...
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


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


my project has login in whic i should select the company name in dropdown box.... so when i login i all the three username,password and dropdown box value(i.e)company name should match.... pls provide code.... thanx


Advertisement
View Answers

April 3, 2012 at 12:25 PM


please some one answer me soon.... i need it soon... pls



April 3, 2012 at 5:28 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">
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
<option value="D">D</option>
</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);
}
%>


Related Tutorials/Questions & Answers:
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 value(i.e)company name should match.... pls provide code.... thanx   1
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 value(i.e)company name should match.... pls provide code.... thanx   
Advertisements
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
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
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
populating one dropdown box depending on the value of other using jsp
populating one dropdown box depending on the value of other using jsp  HI i have scenario i need to populating one dropdown box depending... in dropdown box one after the other CREATE TABLE CITY_MASTER( CITYID BIGINT
to enter into a particular page only if the username,password and listbox value mtches
to enter into a particular page only if the username,password and listbox value... in to his page only if the username, password and the listbox value(user type) matches using "jsp".where the username,password,user type are stored in a single table
fetch database value to text box based on selected value my code given below pls correct my code
fetch database value to text box based on selected value my code given below pls correct my code  my Code Given below Pls... help me send correct code for me jsp file... <%@page contentType="text/html" pageEncoding
fetch database value to text box based on selected value my code given below pls correct my code
fetch database value to text box based on selected value my code given below pls correct my code  my Code Given below Pls... help me send correct code for me jsp file... <%@page contentType="text/html" pageEncoding
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
HTML Login Page Code
JavaScript validation in Login page. We have set username and password value... 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
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
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
DropDown Department Login
me the code on how to login using the drop down box and the Username... and Accounts..A Username and a Password field.Now want to login to the page... login where username='"+user+"' and password='"+pass+"'and department='"+dep
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
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
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
dropdown box
dropdown box  i need to have country,state and city in drop down box using ajax and use db2 database   Have a look at the following link: JSP dependent dropdown
username and password in servlet
username and password in servlet  i'm usng eclipse luna(java programming) Sevlet and apache tomcat8.0 i need to do a login page then after login it must display either invalid user or valid user here is what i done for login
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
validating username and password from database
validating username and password from database  Hello sir, i am developing a login page. i want that when i fill data in text fields. it validate data from database. if enter data is match from database. page goes to next page
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
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
populate dropdown box
my dropdown menu with values from 1 to n (n = the value stored in database)using java script or jsp, either is fine? Ex: If value corresponding to selected item in dropdown menu is 10 then the second dropdown box should contain values
 

 

 

DMCA.com