aspose file tools*
The moose likes Servlets and the fly likes Applets - web application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Applets - web application" Watch "Applets - web application" New topic
Author

Applets - web application

muthu bharathi
Ranch Hand

Joined: Dec 10, 2008
Posts: 97
Hi,
How can we get the client's IP Address?
Iam using Applet web application(Applet+tomcat server).

Any one known about that please give me the sample code..


-- thanks in advance

-- bharathi
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42276
    
  64
Would this code run in the applet or the servlet? If the latter, check out HttpServletRequest.getRemoteAddr method. Be sure to read its javadocs.


Ping & DNS - my free Android networking tools app
muthu bharathi
Ranch Hand

Joined: Dec 10, 2008
Posts: 97
Hi,
Thanks for quick response.

Im new to this concept. please send me the complete code.

and also please give me some samples for Applet run on Tomcat Server..

very urgent....

--
Bharathi
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42276
    
  64
Im new to this concept. please send me the complete code.

The code of what? It's just a single method call.

also please give me some samples for Applet run on Tomcat Server.

What would these examples show? An applet consists of an HTML (or JSP) file containing an applet tag, and some class files (or maybe jar files), all placed together in a public directory in your web app. The Sun Java Tutorial explains all this in detail.
muthu bharathi
Ranch Hand

Joined: Dec 10, 2008
Posts: 97
hi,
If we use httpRequest we'll get only the last Proxy IP address.

How we get the client machine's IP in J2EE Application.


-- thanks in advance,
--
bharathi
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42276
    
  64
If there's a proxy in between, then the proxy can usually be configured to set the originating IP address in an HTTP header. Ask your network administrator about that.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42276
    
  64
What do you mean by "change the Applet code into web application"? As far as I can tell -and you made it unnecessarily hard to read the code, because you didn't UseCodeTags; please do that in the future- all the applet does is to determine the local IP address. Are you asking how to determine the local IP address of the servlet container that runs the web app? I already mentioned how to get a client IP address in a web app.
Richard Corbin
Greenhorn

Joined: Nov 22, 2008
Posts: 12
[Edit; not-so-nice post removed. Tread carefully.]
[ December 14, 2008: Message edited by: Bear Bibeault ]
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
If you need someone else to develop for you, try posting the question at http://www.rentacoder.com or http://www.freelancers.net

If you are capable to write code yourself, but you stucks with a technical coding problem, then you are always welcome here to ask for help. But please ask the question the smart way. Elaborate about the coding problem in detail. Asking for code isn't going to work here. The more effort you put in asking the question the smart way, the more effort others will put in giving the answer, including more chance on a (relevant) code example.

Good luck.
muthu bharathi
Ranch Hand

Joined: Dec 10, 2008
Posts: 97
Hi Scholtz,

Please Answer my Query:-

Im a new bie....

How can i get the clients IP Address using J2EE Application thro' Applet(Applet+servlet+Tomcat server).

some one was answered my query... but i can't understood that concept....

I know how to find the clients IP Address using Applet. now i want to know if some one(client) login into that particular site, That client Machines IP 'll be displayed in server... that's what i need

--- Advance Thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42276
    
  64
some one was answered my query... but i can't understood that concept....

Then tell us what you have trouble understanding, and we'll try to help you understand.

I know how to find the clients IP Address using Applet.

Probably not, actually, at least not reliably. Many computers are behind NATed firewalls, and so what the applet will get is something like "192.168.....". That's an internal address that doesn't tell you anything about the client.

now i want to know if some one(client) login into that particular site, That client Machines IP 'll be displayed in server...

Didn't we discuss that already? What did the network admin say regarding passing on the real IP address in addition to the proxy address?
muthu bharathi
Ranch Hand

Joined: Dec 10, 2008
Posts: 97
Hi,

Thanks ulf....

MY task is working fine... thanks a lot.

i've one more doubt...

i've two text boxes(Name and password) in Applet and also i've another two text boxes and a submit button in JSP.

While i click on the submit button, the browser will display the values of name and password and also to display the values of two boxes(ie, in jsp).

I need guidance for Applet and JSP communication...


once again thanks a lot.

Advance thanks

-- bharathi
muthu bharathi
Ranch Hand

Joined: Dec 10, 2008
Posts: 97
Hi everybody,

i was tried <jsp lugin>. the codes are compiled. At run time i was got the following error. Anybody known about that please help

***************************************************
oad: class daytimeapplet.class not found.
java.lang.ClassNotFoundException: daytimeapplet.class
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: open HTTP connection failed:http://localhost:8080/Applet_servlet/build/classes/daytimeapplet/class.class
at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
**************************************************************


I thought the error was in java(TM) plug-in.....

please verify it and clarify my doubt....

--ADvance Thanks

bharathi
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42276
    
  64
Let's not divert this topic from the original question. Please start two new topics for these unrelated questions.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Applets - web application