Ver Mensaje Individual
  #2 (permalink)  
Antiguo 22/02/2011, 10:05
Avatar de jhonmelguizo
jhonmelguizo
 
Fecha de Ingreso: enero-2008
Ubicación: Medellín - Colombia
Mensajes: 264
Antigüedad: 16 años, 3 meses
Puntos: 6
Información Respuesta: Ayuda necesito obtener IP visitante en Struts 1

Hola, quizás sea de ayuda:

Código JAVA:
Ver original
  1. import java.net.InetAddress;
  2. import java.net.UnknownHostException;
  3.  
  4.     /**
  5.      * Entrega nombre de usuario local o ip(Desde donde se abre la aplicación)
  6.      * @return String
  7.      */
  8.     public static String getUser(){
  9.         try {
  10.             return InetAddress.getLocalHost().toString();
  11.         } catch (UnknownHostException ex) {
  12.             return "Error al retornar el nombre de usuario: " + ex;
  13.         }
  14.     }