Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8636239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:10:56+00:00 2026-06-12T10:10:56+00:00

I am trying to make login validation in using httpClient and getting infinite loop

  • 0

I am trying to make login validation in using httpClient and getting infinite loop on server side.More explanation will be after code. here is my server side code

    public void doPost(HttpServletRequest req, HttpServletResponse resp)
    while(true){    
        String user_name = req.getParameter("username");
        String password = req.getParameter("password");
        System.out.println("User name and password is "+user_name +"   paswword is "+password);
        resp.setContentType("text/plain");
        PrintWriter writer = resp.getWriter();
        if(user_name.equalsIgnoreCase("haseeb")){
            System.out.println("valid user name");
            writer.write("welcome");
            //writer.flush();
            break;
        }
        else{
            writer.write("unknown User");
            System.out.println("unknown user name");
            writer.flush();
            continue;
        }

    }//End of while loop

}   //End of doPost Method

from client side i am trying to login, if login is invalid the server will return “unknownUser” after that client will send again request to login if login is valid the loop will break. on server side i am getting infinite loop and server is processing on first request parameters again and again and again….!!! If any one want i can post my client side code for further assistance, you can ask for it on comments section..Thankyou

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T10:10:58+00:00Added an answer on June 12, 2026 at 10:10 am

    You don’t seem to understand how HTTP requests work.

    The user’s browser sends a request to the server asking for the login page, the server responds with the HTML and that response ends there. Then, the user validates his credentials, causing the browser to send a new request, and the server responds with either the page after the login, or the login page again and a message indicating that the credentials did not match, but in both cases the response ends there again. HTTP connections are not kept, it’s just a series of requests and responses in separate connections.

    So you don’t use a loop, you just send the appropriate HTML back, once per request.


    This still holds even if the user’s application is a desktop application and not a browser, as long as it uses HTTP as its transport. You can’t resubmit data using the same request, at least not if you use the HttpServletRequest / HttpServletResponse paradigm.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a server-side login process with facebook in my C# MVC
I'm trying to make a login page using html, ajax & ASP.NET.The data is
I'm trying to make an auto-login using Greasemonkey. Can anyone help me? Relevant HTML
i'm a beginner in PHP and i'm trying to make a login screen using
Im trying to make a symple login system using swingf, I am having some
I am trying to make the login work... but when i register (using the
I'm trying to make a login page for my website I am using xampp
I'm trying to make Login feature by using TCP Client. I have two forms:
I'm trying make a login window where a user is prompted to enter their
I am trying to make a Facebook login in my website, I have faced

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.