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

  • SEARCH
  • Home
  • 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 8170307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:06:23+00:00 2026-06-06T21:06:23+00:00

I want to create a Login Form in Swing JAVA and when the user

  • 0

I want to create a Login Form in Swing JAVA and when the user clicks on the submit button it should use a GET call to GET the user information from a URL.
My login form is having two fields:
username:
password:
and “submit” button

I have used the following code. I am working in NetBeans 7.1.2 .I new to Java.

 public void actionPerformed(ActionEvent ae)throws IOException
  {
 String value1=text1.getText();
String value2=text2.getText();
URL url = new URL("http://link?      userName=value1&password=value2");
HttpURLConnection httpCon = (HttpURLConnection) url.openConnection(); 
httpCon.setDoOutput(true); httpCon.setRequestMethod("GET");
OutputStreamWriter out = new OutputStreamWriter( httpCon.getOutputStream());
System.out.println(httpCon.getResponseCode());
System.out.println(httpCon.getResponseMessage());
out.close(); 

}

but it is not working .
Can anyone please tell me where I am wrong OR can give me better way to do this.

 * @author tapasweni
 */
class Login extends JFrame implements ActionListener
{

I am using this but now I am getting error code 404 whereas if I typed the URL in the browser it is giving me the correct result.

  • 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-06T21:06:24+00:00Added an answer on June 6, 2026 at 9:06 pm

    This is because you coded the litterals “value1” and “value2” and not their variables in the URL. Try this instead:

    URL url = new URL("http://wisekar.iitd.ernet.in/active/api_resources.php/method/user?userName="+value1+"&password="+value2);
    

    Note that you should use a URLEncoder (with charset UTF-8) to encode those values.

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

Sidebar

Related Questions

I have created a form to login and password in java swing. I want
I am new In ASP.NET, I want to create to Login Form using Membership
How can I create my own login form on frontend? I don’t just want
I am looking to create a login form for an Android application. I want
I want to create a simple login and registration form, that allows me to
i want to create login form using sqlite in iphone view based application please
Helo... i'm new in cakephp, i want to create 2 login form, 1 for
I want to create an iPad-like pop-over with a login form in Sencha touch.
I want to create a login form on a single HTML page to display
I need to create a java program which should go to a website's login

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.