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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:15:17+00:00 2026-06-07T04:15:17+00:00

i want to send request from android to java tomcat server using servlet, then

  • 0

i want to send request from android to java tomcat server using servlet, then the server will send huge data to client, the data contains of many rows, every row has three parameters:

competitionID, marks, numberOfQuestions

code to send request from android to server

HttpClient client = new DefaultHttpClient();
        URI website;
            website = new URI("http://" + HostIP
                    + ":8080/LocalizedBasedComptitionServer/JoinCompetition");
            HttpPost request = new HttpPost();
            request.setHeader("ID", ID + "");
            request.setURI(website);
            HttpResponse response = client.execute(request);

servlet code

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        ServletOutputStream out = response.getOutputStream();
        CellDatabase cDB = new CellDatabase();
                List<String[]>list = new LinkedList<String[3]>();
        out.flush();
    }

how can i send the List list and how can i receive it?

  • 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-07T04:15:18+00:00Added an answer on June 7, 2026 at 4:15 am

    There are a few ways to achieve this:

    1.Format the response as a JSON array, e.g.:

    [ 
       { competitionId : "6", marks : "2", numberOfQuestions : "3"},
       { competitionId : "2", marks : "1", numberOfQuestions : "5"},
    ]
    

    Then your client will just parse this JSON string into array

    2.Create your own delimited string result, e.g.:
    6,2,3|2,1,5

    Since you know the response will be an array of 3 elements, you can first separate items by a special character ‘|’, then for each array item split it again by delimiter ‘,’ and you will get your competition id, marks, and num questions.

    This method is quick and easy but difficult to maintain: If you add/remove new elements, or change delimiter on the server side, your client will break. So using the JSON method probably is the way to go.

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

Sidebar

Related Questions

I want to send a request to another server from my servlet and get
I want tot send a friend request using the Facebook Android SDK. I'm currently
I want to create one simple application for sending request from iphone(client) by using
Is there any way to send request from a server to an Android phone?
How can i send a data from Server to android directly without waiting for
In python, I want to send a request to a url which will return
I want to send some information from PHP to Java. Why? Because I have
I have an Android application from which I want to upload some data to
I want to send a couple of values to a web server from my
I'm working on an Android application that will send MMS internally without using the

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.