ASH
ASH

Reputation: 1058

Requesting different parameters using request.getParameter

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"));

...

Upvotes: 0

Views: 107

Answers (1)

developerwjk
developerwjk

Reputation: 8659

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.

Upvotes: 1

Related Questions