File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Murach's Java Servlets and JSP this week in the Servlets 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
Similar Threads
Apache-Tomcat Integration Problem: only works locally.
servlet URL
Apache -> Tomcat servlet problem
compiled the servlet - I have - how do I run it - please help!!!!!
problem with mapping using servletrunner