Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-08-2007, 04:13 AM
Senior Member
 
Join Date: Jun 2007
Posts: 119
Peter is on a distinguished road
problems with Login
I've done a simple system login. Consists of a form that asks to the user the id and password, after that this information sends to a servlet,
here is the code

Code:
// SERVLET public class LoginServlet extends HttpServlet { private static final long serialVersionUID = 1L; private HttpSession moSesion = null; private HttpServletRequest moRequest; private HttpServletResponse moResponse; private UsuarioBean moUser = new UserBean(); // Datos enviados por la URL private String msLogin = ""; private String msPassword = ""; private String msCode = ""; /** Initializes the servlet. */ public void init(ServletConfig config) throws ServletException { super.init(config); } /** Destroys the servlet. */ public void destroy() { } /** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods. * @param request servlet request * @param response servlet response */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { moRequest = request; moResponse = response; msLogin = request.getParameter("login"); msPassword = request.getParameter("password"); } private void inicializeBean() { moUser.setCode(msLogin); moSesion = moRequest.getSession(true); moSesion.setAttribute("objUser", moUser); } private void redirection(String sURL) throws ServletException, IOException { RequestDispatcher send = getServletContext().getRequestDispatcher(sURL); send .forward(moRequest, moResponse); } }
The problem is when a user login, and then other user login, the first user sees the second user's details
Do you understand?
Would you help me?
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-09-2007, 02:06 AM
Senior Member
 
Join Date: Jun 2007
Posts: 164
Heather is on a distinguished road
Hi,
The servlet doesn't instance once time, it isn't correct
Please visit this link, maybe it helps you
http://www.acknowledge.co.uk/java/tu...threading.html

Another thing that I noticed is: Sessions!!!!
each new browser that calls your application creates a session, it isn't the same for every browsers.
good luck
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 06-12-2007, 02:50 PM
Senior Member
 
Join Date: Jun 2007
Posts: 130
Jack is on a distinguished road
Maybe you should invalidate (session.invalidate) the old session before create a new one, that is to say log out
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Login Forms dankonsoer New To Java 0 11-20-2007 03:38 PM
JSP - Login Page Example JavaForums Java Blogs 2 08-13-2007 10:21 AM
Login with mysql fernando JavaServer Pages (JSP) and JSTL 1 08-07-2007 04:30 PM
I want to get values from login jsp trill JavaServer Pages (JSP) and JSTL 1 08-07-2007 08:33 AM
Struts and login Peter Web Frameworks 2 07-04-2007 04:36 PM


All times are GMT +3. The time now is 01:15 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org