jsp get ip address

后端 未结 6 1727
挽巷
挽巷 2020-12-20 03:15

whats the best way of preventing someone from voting twice? How do i get the users ip address? What if they are on a large network? will everyone on that network show the sa

6条回答
  •  执笔经年
    2020-12-20 03:48

    In your JSP, use request.getRemoteAddr(). This returns the IP address of the agent that sent the request as a String.

    Also, request.getRemoteHost() will attempt to get the fully qualified host name. If it can't resolve the name however, the IP address will be returned as in getRemoteAddr().

提交回复
热议问题