| Author |
Get the IP dynamically
|
Monarch Bhojani
Ranch Hand
Joined: Feb 27, 2005
Posts: 46
|
|
Hello all I am making a chat application in which i use JSP and Servlet Now I have provided the normal login page that is in swing that calls the servlet and does the authentication with the server against databse Now i would only be giving the swing gui to the client in a jar But the IP that i pass while compiling and making a jar of swing client is static Now every time the server changes i need to recompile the class file Taking the case of yahoo that must be having many servers but the client never needs to specify the IP Is there any way that my client can get the IP without me having to recompile it everytime before giving it to the client Thanks Regards Monarch
|
 |
Jeffrey Spaulding
Ranch Hand
Joined: Jan 15, 2004
Posts: 149
|
|
Usually no ip address is passed, instead a servername is used, so the resolution of the address is done by the DNS. But if you have resources that need to be read dynamically you can use ResourceBundles. This technique is usually applied to localize an application for different languages, but you can use it for each information that has to be stored outside of the class. http://www.javaalmanac.com/egs/java.text/LocMsg.html [ April 18, 2005: Message edited by: Jeffrey Spaulding ]
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
If you package and deliver your Swing app as an applet, you will have the getDocumentBase method available to you. http://java.sun.com/j2se/1.4.2/docs/api/java/applet/Applet.html#getDocumentBase()
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
 |
|
|
subject: Get the IP dynamically
|
|
|