Results 1 to 3 of 3
  1. #1
    Peter is offline Senior Member
    Join Date
    Jun 2007
    Rep Power

    Default 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

    Java 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 {
    /** Destroys the servlet.
    public void destroy() {
    /** Processes requests for both HTTP <code>GET</code> and <code>POST</code>
    * @param request servlet request
    * @param response servlet response
    protected void processRequest(HttpServletRequest request, HttpServletResponse
    throws ServletException, IOException {
    moRequest = request;
    moResponse = response;
    msLogin = request.getParameter("login");
    msPassword = request.getParameter("password");
    private void inicializeBean() {
    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?

  2. #2
    Heather is offline Senior Member
    Join Date
    Jun 2007
    Rep Power


    The servlet doesn't instance once time, it isn't correct
    Please visit this link, maybe it helps you

    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

  3. #3
    Jack is offline Senior Member
    Join Date
    Jun 2007
    Rep Power


    Maybe you should invalidate (session.invalidate) the old session before create a new one, that is to say log out

Similar Threads

  1. Login Forms
    By dankonsoer in forum New To Java
    Replies: 1
    Last Post: 08-07-2008, 01:06 PM
  2. Login with mysql
    By fernando in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 08-07-2007, 04:30 PM
  3. I want to get values from login jsp
    By trill in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 08-07-2007, 08:33 AM
  4. Struts and login
    By Peter in forum Web Frameworks
    Replies: 2
    Last Post: 07-04-2007, 04:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts