jsp login code when username , password and dropdown box value is correct...

Ads

 
 

Share on Google+Share on Google+

Abinesh
jsp login code when username , password and dropdown box value is correct...
2 Answer(s)      5 years and 5 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

Ads
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:

<[email protected] 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);
}
%>

Ads









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
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
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
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... <[email protected] 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... <[email protected] contentType="text/html" pageEncoding
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
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
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
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
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
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
JSP code for forget password
JSP code for forget password  I need forget password JSP code.. example http://www.roseindia.net/users/forgotpassword.html
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
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
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
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
how to use dropdown list in JSP and display value in same page
how to use dropdown list in JSP and display value in same page  I have a Dropdown list with some values say "A", "B" and "C" When the user selects... in the same page Value selected = C How can we do this in a JSP 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
login-password - Java Beginners
login-password  complete code of login-password form then how to connect the bank simulation project?   Hi friend, login...; } Login Application in JSP