getRemoteAddrpublic String getRemoteAddr()    Returns the Internet Protocol (IP) address of the client or last proxy that sent the request. For HTTP servlets, same as the value of the CGI variable REMOTE_ADDR.    Returns:
        a String containing the IP address of the client that sent the request

解决方案 »

  1.   

    javax.servlet.http.HttpServletRequest.getRemoteAddr()Methods inherited from interface javax.servlet.ServletRequestpublic java.lang.String getRemoteAddr()
    Returns the Internet Protocol (IP) address of the client that sent the request. For HTTP servlets, same as the value of the CGI variable REMOTE_ADDR.Returns:a String containing the IP address of the client that sent the request----------------------------------------------------------------------上面是从JSDK2.3 API文档里拷贝的。
    举个例子:
    remoteaddr.jsp
    ...
    <%
    Stting ip = request.getRemoteAddr();
    %>
    ...如果要写bean的话,就:
    import javax.servlet.http.HttpServletRequest;
    ...
    //method
    public String getIP(HttpServletRequest req) throws Exception
    {
       String ip;
       ip = req.getRemoteAddr();
       return ip;
    }
    ...我也初学者,很多东西也不太懂。如果说的不对,请直接指出来。
      

  2.   

    用隐含对象request.getRemoteAddr()就可以了
      

  3.   

    您的地址为:<%=request.getRemoteAddr()%>
      

  4.   

    可是jsp是运行在服务器端的,会不会得到的是服务器的ip而不是客户端的ip呢?
      

  5.   

    Remote的意思是什么??搞不懂这么多SB