This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes Servlets and the fly likes (Beginner) Calling Servlet from Applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "(Beginner) Calling Servlet from Applet" Watch "(Beginner) Calling Servlet from Applet" New topic

(Beginner) Calling Servlet from Applet

joseph corner
Ranch Hand

Joined: Feb 20, 2004
Posts: 50
I'm trying to call a servlet from an applet. It's working at the moment, but the applet is in the web module which also contains the servlet. I would like to put the applet in my normal htdocs folder, as I'm trying to implement http tunneling. The applet must therefore be called via port 80, from a normal html page.
At the moment, the applet finds the servlet address by using getCodeBase().
I'd like to just use (my website URL + /servlet/ + servletName) to form the servlet URL.
However, in my local tests, I can't get my servlets to display using, eg. http://localhost/servlet/myServlet. Instead, I must use http://localhost:8080/myWebModule/myServlet
What must I do to make "/servlet/" work? Am I right in thinking that it would be a mistake to hardcode the port number, as it might not always be the same? Do I need to include the name of the web module in the servlet URL? (e.g. http://localhost/servlet/myWebModule/myServlet) Needless to say, I have tried this and it didn't work...
I'm testing using Eclipse with the Lomboz plug-in.
Thanks for guidance!
[ March 08, 2004: Message edited by: joseph corner ]
joseph corner
Ranch Hand

Joined: Feb 20, 2004
Posts: 50
And my servlet container is Tomcat, btw.
I agree. Here's the link:
subject: (Beginner) Calling Servlet from Applet
It's not a secret anymore!