• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ipaddress in servlets

 
santosh akella
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

i have a login page developed in servlets..
i want the IPADDRESS of the user u calls this servlet can it be possible
how can this be done??
thank u
 
Frederic Filiatrault
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi !

Sure ! Here it is:


javax.servlet
Interface ServletRequest
public java.lang.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



 
santosh akella
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank u
i got it ....
well i want all the information passed by the user and create an XML file
for passing this information to another server .
how can i do this.

thank u once again
 
Frederic Filiatrault
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It goes back to HTTP request. All the info you received from the request are the only you can use. Look at the ServletRequest interface and HttpServletRequest. Does interface/classes will give you all the info that you can obtain from the client.

It makes sense, no ?

thk !
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic