How do I pass multiple parameter in URL?

前端 未结 3 1305
猫巷女王i
猫巷女王i 2020-12-13 00:38

I am trying to figure out how to pass multiple parameters in a URL. I want to pass latitude and longitude from my android class to a java servlet. How can I do that?

3条回答
  •  甜味超标
    2020-12-13 01:06

    You can pass multiple parameters as "?param1=value1¶m2=value2"

    But it's not secure. It's vulnerable to Cross Site Scripting (XSS) Attack.

    Your parameter can be simply replaced with a script.

    Have a look at this article and article

    You can make it secure by using API of StringEscapeUtils

    static String   escapeHtml(String str) 
              Escapes the characters in a String using HTML entities.
    

    Even using https url for security without above precautions is not a good practice.

    Have a look at related SE question:

    Is URLEncoder.encode(string, "UTF-8") a poor validation?

提交回复
热议问题