Hi Erdem, There's no way that code is going to print any IP address. I see you're calling the session.getAttribute("ip"); which is not set anywhere in that piece of code.
You may want to have the attribute set first before making use of it. -- Evans http://www.javawug.org ----- Original Message ----- From: "Erdem Bozdağ" <erdemboz...@su.sabanciuniv.edu> To: <java-ee-j2ee-programming-with-passion@googlegroups.com> Sent: Tuesday, March 31, 2009 2:05 PM Subject: [java ee programming] what is wrong in this code i am trying to gain user's ip address via listenner but ı couldnt success public void attributeAdded(HttpSessionBindingEvent arg0) { try { FileWriter file = new FileWriter("C:/authentication_log.txt"); session = arg0.getSession(); String ip = (String) session.getAttribute("ip"); file.write(ip +": "+new Date()+"\n"); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Java EE (J2EE) Programming with Passion!" group. To post to this group, send email to java-ee-j2ee-programming-with-passion@googlegroups.com To unsubscribe from this group, send email to java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en -~----------~----~----~----~------~----~------~--~---