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



Home Answers Viewqa Java-Beginners pls send me the code for login and register
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


ramya
pls send me the code for login and register
1 Answer(s)      6 years and 2 months ago
Posted in : Java Beginners



Advertisement
View Answers

September 19, 2008 at 7:01 PM


Hi friend,


This login action code.

<%@ page language="java" import="java.sql.*" import="java.util.*" %>


<%



String userid = request.getParameter("userid");

String password = request.getParameter("password");



Connection con = null;
String url = "jdbc:mysql://192.168.10.211:3306/";;
String db = "amar";
String driver = "com.mysql.jdbc.Driver";
String userName ="amar";
String pass="amar123";

try {

Class.forName(driver);
con = DriverManager.getConnection(url+db,userName,pass);

Statement st = con.createStatement();

String strQuery = "select * from login where userid='"+userid+"' and password='"+password+"'";

out.println(strQuery);

ResultSet rs = st.executeQuery(strQuery);



while(rs.next()){

if((rs.getString(1).equals("admin")) && (rs.getString(2).equals("admin")))

{

session.setAttribute("userid",userid);

response.sendRedirect("userForm.jsp");
}


if((rs.getString(1).equals("user")) && (rs.getString(2).equals("user")))

{

session.setAttribute("userid",userid);

response.sendRedirect("registrationForm.jsp");
}

else{

response.sendRedirect("loginForm.jsp");

}


}

System.out.println("Connected to the database");

con.close();



} catch (Exception e) {

e.printStackTrace();

}

%>

-------------------------------------------------

I am sending you a link. This link will help you. Please visit for more information.

http://www.roseindia.net/jsp/user-registration-form-using-jsp.shtml


Thanks.


Related Tutorials/Questions & Answers:
pls send me the code for login and register - Java Beginners
pls send me the code for login and register  pls immediately send me the jsp code for login and registration with validation with java bean in mysql database...  Hi friend, This login action code
pls send code
pls send code   pls send code for set database value into text box based on selected value in struts and jsp   use any database and get its code for getting values from google
Advertisements
Pls send code
Pls send code   I am Mohini Charankar suppose Name="Mohini" Edit Button Click on that I change my Name with "Mohini/" Save it and page refresh After... an error pls send code
login and register - Java Beginners
login and register  pls send me the code for login and register immediately  Hi friend, Please specify the technology you want code for login and register. For example : JSP,Servlet,Struts,JSF etc
send me javascript code - Java Beginners
send me javascript code  please send me code javascript validation code for this html page.pleaseeeeeeeee. a.first:link...          Hi friend, complete code
pls send maven interview questions
pls send maven interview questions  pls send maven interview questions to anvesh2406@gmail.com
how to send email please give me details with code in jsp,servlet
how to send email please give me details with code in jsp,servlet  how to send email please give me details with code in jsp,servlet
I didn't gat an output for this code, plz send me a correct code
I didn't gat an output for this code, plz send me a correct code  Hi, Here is my code: import java.awt.event.*; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import javax.swing.*; import java.sql.*; public
pls send reply - Java Beginners
pls send reply  i get the error Error Occurred:java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES) how to remove
pls help me it urgent
pls help me it urgent  hey, pls help me i want to know that can we call java/.bat file from plsql/proceudre /trigger
pls help me it urgent
pls help me it urgent  hey, pls help me i want to know that can we call java/.bat file from plsql/proceudre /trigger
pls help me it urgent
pls help me it urgent  hey, pls help me i want to know that can we call java/.bat file from plsql/proceudre /trigger
Pls anyboby tell me...
Pls anyboby tell me...  which book easy to learn spring
Pls help me with strings
Pls help me with strings  To reverse a every other word in a string. Example :- If the input is "This is a line of message" the output should be "sihT is a line fo message
Pls help me with strings
Pls help me with strings  To reverse a every other word in a string. Example :- If the input is "This is a line of message" the output should be "sihT is a line fo message
pls help me with this question
pls help me with this question  how to write a program in C++ using encapsulation,polymorphism,inheritance and abstraction?(all these concepts should come in a single program
Pls help me...........
Pls help me...........  how to use the text file as input to insert the values injdbc?   Please visit the following link: Insert text file data into database
pls send reply - Java Beginners
pls send reply  i get the error Error Occurred:java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES) how to remove   Hi Friend, Check your connection string, username
please send me javascript validation code - Java Beginners
please send me javascript validation code  hallo sir , please send me java script code for this html page.since i want to do validation.i am a new user in java ....please send me its urgent
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 field....  my project has customer registration and company registration........ pls provide me code.. thanx
Code to register a new patient in a clinic
Code to register a new patient in a clinic  Hi, How do i write a code that allows a user to enter someone's name and then search for that name from a text file. If the name is not available it opens up a form to register
pls. help me - Java Beginners
pls. help me  please help me i do need now if its okay... Consider the method headings: void funcOne(int[] alpha, int size) int funcSum(int x,int y) void funcTwo(int[] alpha, int[] beta) and the declarations: int
sir, how to convert excel file to csv file using java? please send me sample code.
sir, how to convert excel file to csv file using java? please send me sample code.  please send me sample code for converting excel file into csv file uisng java
i want to create website,with manu with three level submenu on top side of page please send me code java
i want to create website,with manu with three level submenu on top side of page please send me code java   iam createing wibsite thats using eclipse andtomcat server,please help me to write menu with three level submenu
sourse code pls
sourse code pls  customer registration code in java?   Hello Friend, Please visit the following links: http://www.roseindia.net/jsp/javascriptpagerefresh.shtml http://www.roseindia.net/jsp/user-registration-form
send me example of jmsmq - JMS
send me example of jmsmq  please send me example about jmsmq (java microsoft message queuing ) library
please send me the answer - JDBC
please send me the answer -difference between DriverManager and DataDourse   what is Datasourse? What r the advantages? what is the difference between DriverManager and DataDourse
pls help me sir its urgent
pls help me sir its urgent  thanks for reply, but i am getting this error pls help me its urgent type Exception report message description The server encountered an internal error () that prevented it from
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
pls review my code - Struts
pls review my code  When i click on the submit page i am getting a blank page Pls help me. thanks in advance. public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request
Pls review my code - Struts
Pls review my code  Hello friends, this is my code in struts action class this page contains checkboxes and radiobuttons also. when i enter the submit it shows me blank page. can anybody solve my problem its urgent. help me
Advertisements
 

 

 

DMCA.com