• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Login Security and Display Information Confusion Issue

 
Pranit Sonawane
Ranch Hand
Posts: 172
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, I need a help for complete security login code. As I'm Developing an online forum and i need users to login to it also I am not able to understand that in a book i read the home page was displayed in servlet only using out.println() method. but as my web page or the home page is well defined using CSS so how can i check the login information and redirect the user to his home page as I have different home pages for different users. Or can I place any page which will show the Redirecting Please Wait... this message and then redirect to the appropriate page.
please help..!! Many Thanks for any help in advance..!!!
 
Punit Jain
Ranch Hand
Posts: 1012
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am not able to understand that in a book i read the home page was displayed in servlet only using out.println() method.

perhaps you are reading any old book.
putting html into servlet is bad way to go use jsp instead.

but as my web page or the home page is well defined using CSS so how can i check the login information and redirect the user to his home page as I have different home pages for different users.

take you username and password values in requestParameter in servlet and check check for username and password.
you can use sendRedirect or to redirect to userarea page and display user information correspond to the username and password.
 
Pranit Sonawane
Ranch Hand
Posts: 172
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well i'm reading that JDBC, Servlets and JSPs Black Book by Santosh Kumar its a 2010 edition. and in that it is given that he has added the html display using out.println() method. for example out.println("<h1>Hello</h1>"); this line will print Hello in h1 size. Do i need to change my book?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64720
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unless that is an early example before moving on to more complex subjects, I would suggest so. Emitting HTML in a servlet is not a good practice.
 
Pranit Sonawane
Ranch Hand
Posts: 172
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok. But I'm sorry am still confused. What need to be done now? and If I want a code that once the user is logged in then until he clicks on logout a session should not be over and it should pop up saying Do You want to resubmit the query Please help me am completely stuck and this is the last phase of my project.
 
Punit Jain
Ranch Hand
Posts: 1012
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ok. But I'm sorry am still confused. What need to be done now?

What yo have done up to now?

when you checked for login, set the user id to session, and in userarea page you can check that weather session is exist or not, if session is there don't ask for login again.
and for logout, you can just invalidate the session.
session.invalidate();
 
Pranit Sonawane
Ranch Hand
Posts: 172
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well the designing part is over and now i'll begin with the login thing. In that what i want to check if the user is of first year then he should be redirected to FYBCA home page automatically. How can I do that?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic