How can I get parameter from servlet with a specific name in android activity?

like in java servlet request.getParameter("name");

Here is example

i don't need you to tell me to google it, i have searched in google but i don't find the answer.
if you don't know the answer plz be quite
thank you

And if you tried you would have posted code that you have and is failing instead of pathetically downvoted my reply. So play nice, since there is 95% propability that only answer you get here will be from me as nobody else from regulars does Android here. I enjoy challenges and hate lazy people. Think about it

I am not failing in a part. I am just to know if there is away to do that!

Obviously there is way to do it. However if you do not give me any starting ground (in a form of code) all I can do is only point in direction of google as I did

This is my code, in result I get the servlet respone as String I want to get it as a parameter.
Thank you

     public boolean LoginData() throws UnsupportedEncodingException {
            //return true;

            // Create a new HttpClient and Post Header
            HttpClient httpclient = new DefaultHttpClient();

        // login.php returns true if username and password is equal to saranga 
            HttpPost httppost = new HttpPost("http://xxxx.xxx");


                // Add user name and password
                EditText uname = (EditText)findViewById(R.id.txt_username);
                uname.setFocusable(true);
                String username = uname.getText().toString();

                EditText pword = (EditText)findViewById(R.id.txt_password);
                String password = pword.getText().toString();


                List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
                nameValuePairs.add(new BasicNameValuePair("username", username));
                nameValuePairs.add(new BasicNameValuePair("password", password));


                            try{
                httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));



                HttpResponse response = httpclient.execute(httppost);

                String str = inputStreamToString(response.getEntity().getContent()).toString();
                result.setText("Login successful");

                }
                catch(ClientProtocolException ex)
                {
                    result.setText("Login failed Please try again");
                    uname.setText("");
                    pword.setText("");

                }





            } catch (ClientProtocolException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }


            private StringBuilder inputStreamToString(InputStream is) {
            String line = "";
            StringBuilder total = new StringBuilder();
            // Wrap a BufferedReader around the InputStream
            BufferedReader rd = new BufferedReader(new InputStreamReader(is));
            // Read response until the end
            try {
                while ((line = rd.readLine()) != null) { 
                    total.append(line); 
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
            // Return full string
            return total;

        }

Note the servlet return or redirect JSP

Yes you can use JSON. Get some simple library for server so you do not have to do it by hand, and on Android you can use either Jackson or Google GSON

I can not do any thing in the server side, can this be done with Google GSON?

I have searched and it seems not!

If you aer not able to do changes to server and if server doesn't provide JSON output then there is nopoint for Android implementation of it

can I know if the server support JSON from the website?

thank you

I'm not aware of any tool that autocheck if JSON provided. Sorry

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.