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 5932487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:50:27+00:00 2026-05-22T14:50:27+00:00

I am implementing an applet —servlet communication. There are two parameters that need to

  • 0

I am implementing an applet —servlet communication. There are two parameters that need to be sent by applet to the servlet. I am not sure can I implement the transferring process as follows? If not, how to handle the transferring processing involving multiple parameters? Thanks.

Applet side:

// send data to the servlet
             URLConnection con = getServletConnection(hostName);
             OutputStream outstream = con.getOutputStream();
             System.out.println("Send the first parameter");
             ObjectOutputStream oos1 = new ObjectOutputStream(outstream);
             oos1.writeObject(parameter1);
             oos1.flush();
             oos1.close();

             System.out.println("Send the second parameter");
             ObjectOutputStream oos2 = new ObjectOutputStream(outstream);
             oos2.writeObject(parameter2);
             oos2.flush();
             oos2.close();

Servlet side:

    InputStream in1 = request.getInputStream();
    ObjectInputStream inputFromApplet = new ObjectInputStream(in1);
    String receievedData1 = (String)inputFromApplet.readObject();

    InputStream in2 = request.getInputStream();
    ObjectInputStream inputFromApplet = new ObjectInputStream(in2);
    String receievedData2 = (String)inputFromApplet.readObject();
  • 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-05-22T14:50:27+00:00Added an answer on May 22, 2026 at 2:50 pm

    For simplicity, you should use HTTP GET or POST parameters (since they are String values).

    Applet side :

    URL postURL = new URL("http://"+host+"/ServletPath");
    HttpURLConnection conn = (HttpURLConnection) postURL.openConnection();
    conn.setRequestMethod("POST");
    conn.setDoOutput(true);
    conn.connect();
    
    PrintWriter out = new PrintWriter(conn.getOutputStream());
    out.write("param1="+URLEncoder.encode(parameter1)+"&param2="+URLEncoder.encode(parameter2));
    out.flush();
    

    The host can be obtain from getCodeBase().getHost() in you Applet instance.

    Servlet Side :

    void doPost(HttpServletRequest req, HttpServletResponse resp) {
        String parameter1 = req.getParameter("param1");
        String parameter2 = req.getParameter("param2");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Do applet javascript calls serialize in any proper way? I'm considering implementing a model
I'm implementing a AJAX autocomplete/autosuggest feature, and not only do I want to do
I need to implement a process where users punch in a few details into
We currently have a Java applet that generates a lot of data and uploads
I'm implementing a tagging system for a website. There are multiple tags per object
I'm working on an Applet, which has a JButton that I want to use
I am developing an application for iOS 4.x devices. I am implementing a communication
I'm implementing ShareKit in my app. Everything is working fine, but there are many
currently I'm attempting to basically implement and exact copy of Apples iMessage App. That
Should you always create an interface if there's a possibility that there might be

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.