wood burning stoves*
The moose likes JSP and the fly likes Login and Sessions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Login and Sessions" Watch "Login and Sessions" New topic

Login and Sessions

Christin Guhr

Joined: Jun 13, 2002
Posts: 4
hi everybody
I have huge problems to write a jsp page for a login and also compare password and username with my mySQL Database.
please help my.
I tried it for a lot of days but there is no result.
a registrationformular already exists and this one run.but not the login.
I need help!!!
Christin Guhr

Joined: Jun 13, 2002
Posts: 4
so far.Login runs but I already not know how to implements Cookies and sessions.
please help.
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Exactly what part of your application is not working, or do you need help with? What will you be using to manage sessions cookies or httpSession. You might do youself a favour by getting a book to read up on these concepts.

So much trouble in the world -- Bob Marley
Christin Guhr

Joined: Jun 13, 2002
Posts: 4
the loginfunction run.
but no cookie or sessionhandling.
I have 2 JSP Books but they are not very well and the chapters about sessions and Cookies are very bad and short with examples which not run.
So can me sombody tell how I can manage this problem. or is there someone who can recomment my a good JSP-site, because such books are very expensive.
this my login.jsp
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>
<link rel="stylesheet" href="gip.css" type="text/css">
<FORM name="form1" method="post" action="LoginHandler.jsp">
<TABLE border=1 cellpadding=0 cellspacing=0>
<TD>Username: </TD>
<INPUT type="text" name="UserIn" maxlength="10">
<TD>Passwort: </TD>
<INPUT type="password" name="PasswortIn" maxlength="20">
<INPUT type="submit" name="Submit" value="Login">
and this is the LoginHandler.jsp
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>
Connection con;
String url="jdbc:mysql:///vlu";
con = DriverManager.getConnection(url);
Statement stmt = con.createStatement();

String user;
String passwort;
boolean entrance = false;
ResultSet rs = stmt.executeQuery("SELECT * FROM user WHERE USER='"+user+"' AND PASSWORT='"+passwort+"'");
String dbUser = rs.getString("USER");
String dbPassword= rs.getString("PASSWORT");
if ((user.equals(dbUser)) && (passwort.equals(dbPassword))){
if (entrance==true){

<jsp:forward page="geklappt.html"/>

else { %>

<jsp:forward page="error.html"/>
<% }%>
Sean MacLean
Ranch Hand

Joined: Nov 07, 2000
Posts: 621
Thanks for participating here at the Ranch. However, the name you are using does not comply with the naming convention described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name (not fictitious monikers). Please log in with a new name which meets the requirements.
Christin Guhr

Joined: Jun 13, 2002
Posts: 4
I agree. Here's the link: http://aspose.com/file-tools
subject: Login and Sessions
Similar Threads
activate login button
oracle JDBC driver download
login twice
problem with login to the server