birkoff - The book of the secrets

March 22, 2006

Servlet

Filed under: Personales

he aqui in servlet sensillo para obtener la ip dl cliente

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class Ip extends HttpServlet
{
    public void doGet(HttpServletRequest req, HttpServletResponse resp)throws IOException
    {
            String ip=null; //Ip del cliente
            String host=null; //host del cliente
            ip=req.getRemoteAddr();
            host=req.getRemoteHost();
           
            PrintWriter out=resp.getWriter();
            resp.setContentType("text/html");
            String imprime=new String(""+
            "IP: "+ip+"
host: "+host+"");
            out.println(imprime);
    }       
   
}

Comments »

The URI to TrackBack this entry is: http://birkoffh.blogsome.com/2006/03/22/servlet/trackback/

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>



Anti-spam measure: please retype the above text into the box provided.






















Get free blog up and running in minutes with Blogsome
Theme designed by Minz Meyer