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.shtmlThanks.
Related Tutorials/Questions & Answers:
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 Beginnerslogin 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
pls help me it urgentpls 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 urgentpls 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 urgentpls 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 with stringsPls 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 questionpls 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 with stringsPls 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...........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 Beginnerspls send reply i get the error
Error Occurred:java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
how to remove
pls send reply - Java Beginnerspls 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
pls. help me - Java Beginnerspls. 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
Code to register a new patient in a clinicCode 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 sourse code plssourse
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
please send me the answer - JDBCplease
send me the answer -difference between DriverManager and DataDourse what is Datasourse? What r the advantages? what is the difference between DriverManager and DataDourse
Plz send me answer qucklyPlz
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 - Strutspls 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 - StrutsPls 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 pls help me sir its urgentpls 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
pls review my code - Strutspls review my code Hello friends,
This is the
code in struts. when i click on the submit button.
It is showing the blank page.
Pls respond soon its urgent.
Thanks in advance.
public class LOGINAction extends Action
error please send me the solutionerror please
send me the solution HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
error please send me the solutionerror please
send me the solution HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
plz send code for thisplz
send code for this Program to calculate the sum of two big numbers (the numbers can contain more than 1000 digits). Don't use any library classes or methods (BigInteger etc
pls give me answer ae soon as possible - Ajaxpls give
me answer ae soon as possible i m writing
code of ajax technology ...but it is not working
pls check it n give
me response quickly... give
me quick response!!! thanks & regards shashank gupta
java code to send an emailjava
code to
send an email i developed one java
code that has to
send a mail but i am getting an runtime exception calledjavax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465;
nested
php login and logout codephp
login and logout code Hi, Can anyone share there
code for creating a user
login and logout page in PHP?or any useful tutorial that can help to create a
login and logout application in PHP..
Thanks in Advance
login page code in asp.netlogin 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
code for login fom - Strutscode for
login fom we have a
login form with fields
USERNAME:
PASSWORD:
In this admin can
login and also narmal uses can log
HTML login page code the complete HTML JavaScript
code for User
Login Page.
Thanks in Advance!
...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
need code for login in asp.net with c#need
code for
login in asp.net with c# hai iam trying to develop a project in asp.net with c#,so i need a
code for
login page using which admin and other users can log in.plz help
me, thanks in advance
please send code - Java Beginnersplease
send code hai friends plese provide
code for fallowing... number it should be taken as single number)
URGENTLY
send the
code for this Hi friend,
Code to solve the problem :
class StringExampleJava