This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

login  RSS feed

 
jyotsana dang
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all..
iam working on an intranet site for my department..i am making a login page where users will need to sign up and get access to their profiles...something like a mail account.
can anyone please guide me as to what are the steps required..(using jsp for this purpose)..
please, just a vague idea
thanks
 
Idly Vada
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by jyotsana dang:
hi all..
iam working on an intranet site for my department..i am making a login page where users will need to sign up and get access to their profiles...something like a mail account.
can anyone please guide me as to what are the steps required..(using jsp for this purpose)..
please, just a vague idea
thanks

You can store usernames,passwords and authentication info in a database and use them from login servlet. Otherwise you can connect to an LDAP server and perform the authentication.
 
jyotsana dang
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Murthy Narasimha:

You can store usernames,passwords and authentication info in a database and use them from login servlet. Otherwise you can connect to an LDAP server and perform the authentication.

hi..thanks for the suggestion..
but isn't jsp a better option for making logins..and what is an LDAP server.. i have made the database..
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSP is a better option for displaying login page. The authentication can be done in Servlet(or its helper classes).
For LDAP
http://www.gracion.com/server/whatldap.html
 
Idly Vada
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by jyotsana dang:
but isn't jsp a better option for making logins..and what is an LDAP server.. i have made the database..

JSPs are used for display purpose ONLY. LDAP stands for Lightweight Directory Access Protocol. LDAP servers may contain org hierarchy and authentication information.
for more info on LDAP:
http://raleigh.pm.org/ldap-talk.html
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have made the database..

You can store your users in database.
 
jyotsana dang
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pradeep Bhat:

You can store your users in database.

i have made the database with username and password as the fields.. but iam not able to figure out for new users they will fill in the sign-up form...how to insert these records in the database..and please tell me of any good site that's good for jsp ..especially for these logins..
thanks
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would suggest you to read the JSP tut
http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/JSPIntro.html
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If users are going to sign themselves up, you might have them enter userid and e-mail address, then generate a random password and mail it to them. Give them a password update function and require them to use it the first time they log in. All this helps cut down on people impersonating each other.
Your other posts sounded like you're not familiar with using SQL databases from JSP. Post some code excerpts for what you have so far and somebody here will point you to some good next steps.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have several options for writing the login sequence of a web app. As it stands right now, it seems you might need to read up on some material. Especially since you keep asking how to do things, but have provided no evidence of actually trying anything.
1. Go through Sun's JSP Tutorial as was already mentioned.
2. Go through Sun's JDBC Tutorial. They don't give a JSP example, but it will be done the same way.
3. You can also do forms authentication using your App Server (Orion, Tomcat, JBoss, whatever server you are using to server your JSP's). If you let us know which server you are using, we can provide a link for that information
4. Buy a book. Visit our Bunkhouse where you will find reviews on many good JSP books.
Once you get started, and are having problems, post the code you are having problems with and we can continue to help.
[ September 30, 2003: Message edited by: Gregg Bolinger ]
 
jyotsana dang
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello everyone..
racked up my brains..and written a code for new users to sign up..
if anyone could give me more suggestions
if we want to see if a username already exists?? then what??
please help.. am a novice in JSP ..
<%@ page language="java" import="java.sql.*", session="true" %>
<%
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String username=" ";
String password=" ";
Connection con=DriverManager.getConnection("jdbc dbc:iit");
}
catch(ClassNotFoundException e)
{
System.out.println("could not load the driver");
}
catch(SQLException e)
{
System.out.println("couldn not connect to the database");
}
finally
{
try(if(con!=null) con.close(); }
catch(SQLException e)
{}
try
{
Statement stmt=con.CreateStatement();
ResultSet rs=null;
String login=request.getParameter("login");
String Password=request.getParameter("pass1");
String confirm_password=request.getParameter("pass2");
String Email=request.getParameter("email");
String firstname=request.getParameter("fname");
String lastname=request.getParameter("lname");
String address-request.getParameter("address");
String city=request.getParameter("city");
String state=request.getParameter("state");
String pincode=request.getParameter("pincode");
String gender=request.getParameter("gender")
String phone=request.getParameter("phone");
String query="insert into login values("'+fname+"',"'+lname+"',"'+pass1+"',"'+email+"',"'+address+"',"'+city+"',"'+state+"',"'+pincode+"',"'+gender+"',"'+phone+"');
int status=stmt.executeUpdate(query);
if(status!=0)
{
out.println("entry successfully added");
}
else
{
out.println("failed!! try again!);
}
status.close();
con.close();
%>
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if we want to see if a username already exists?? then what??
jyotsana-
what do you think is the sequence of events?
- a user fills out a form (including a username) and clicks on the submit button
- In your servlet (or jsp in your case) will have to validate first whether the values are correct. If they are, you should check if a user in your database is already using the username.
this means that you have to search on the database finding a user whose username is equals to the one you got from the form. If your search on the database retrieves 0 rows, it means the username is available and you can insert the data in the database. Otherwise, you redirect/forward the request to another page and ask a user to try with a different username.
Gregg mentioned a JDBC tutorial, and how to use preparestatements to retrieve/insert data to the database. You can achieve all this with JDBC.
You're doing well , if you've got any specific problems let us know...
P.S: once you start adding HTML stuff to your jsp you will notice that it's better to do all the processing in a servlet.
good luck
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once you feel more comfortable with JSP/servlets/beans, have a look at this article, you'll see how you can use all this technologies and develop better solutions.
 
jyotsana dang
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a ton all!!
iam trying my best.. and doing things one step at a time..
will surely bother all again!!
jyotsana
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!