0

hi i'm using this code from android to send a json to a servlet what works fine, and i was wondering how i could i send a different tag ie Tag2 to the servlet side, but still be able to handle the Tag1 safely on the servlet side

//aproximate desired code //android side

...

url = new URL("http:// 10.0.2.2:8080 /Server/goTo?Tag1="+JSON);

...

url = new URL("http:// 10.0.2.2:8080 /Server/goTo?Tag2="+JSON);

...

//servlet side

...

jsonRequest= new JSONObject(request.getParameter("Tag1"));

...

jsonRequest= new JSONObject(request.getParameter("Tag"));

...

1 Answer 1

1

Use an ampersand:

url = new URL("http://10.0.2.2:8080/Server/goTo?Tag1="+JSON1+"&Tag2="+JSON2);

By the way, you have spaces in your url you need to remove.

Sign up to request clarification or add additional context in comments.

2 Comments

thanks very much :) The spaces are there because stack overflow complains about having 10.0.2.2:8080 when you ask a question. how would i be able to recive it on the servlet side for if i were to send one or the other or both.
Have you tried the url with both? It should just work unless you have an unescaped ampersand inside the first value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.