I am a JSP/Servlet newbie currently adding the first servlets to a web site that had been static all along. My local instance worked great but the servlets did not respond on the test instance. Apparently, my hosting service provider requires me to use an invoker servlet mapping.
Adding this to local web.xml broke the application but the servlets respond on test instance (when their calls are not preceded by another servlet call). A Servlet fails when it is called immediately after another servlet has been called.
What I saw happening on test is URL for first call is of the form:
And URL for the second call became:
The servlets are invoked using "href=servlet/<servlet-name>?Id="
How can I avoid the inclusion of 'servlet' in the URL and reset the URL to the JSP page it navigates to after processing of the servlet? Any kind of help is appreciated.
Thank you very much.
P.S.: I am also trying to enable the Invoker servlet on local so I can troubleshoot easier. I went through the changes to Tomcat's web.xml and context.xml. However, my local servlets did not respond even after calling them using "href=<servlet-name>?Id=". Is there a way I can check if my invoker is active?
Your hosting company requires you to use the invoker servlet? Are you sure? Are you sure they said "must"? Have a look at our FAQ page InvokerServlet which explains in much more detail why that's a bad idea.
As for the URLs which your code is generating, our FAQ page RelativeLinks explains how to handle that issue.
Thank you Paul and Bear for your responses. We have sent an email to our hosting provider requesting them to disable the invoker servlet for our account. Paul, the page on contextual path should solve the issues we are facing. Thank you very much for your time.
Thank you Bear. I hope to become useful to the forum.
So, I read the page on contextual paths and modified my application accordingly. In the meanwhile, I got my hosting provider to disable the invoker servlet as well. Now, the application works in local but does not work on the test server. Could anyone please point to me what I am missing?
I get the feeling that the hosting provider does not let you administer your own Tomcat instance? I suspect that they might be sharing Tomcat instances, and hence, you need to follow their rules for deployment. Perhaps that's why they instructed you to use the invoker.
Does your provider have an instruction pare somewhere on how to deploy apps?
My hosting provider does claim private Tomcat server. I have been given a URL that I can use to re-start my Jakarta-Tomcat server. Hence, I am assuming that is not the case here, although I am unsure about how sharing Tomcat instances would be the cause for the issue described above.
Apps are deployed by FTP to the server and calling the said URL for restarting Tomcat. Earlier, I remember using a URL where I could upload a WAR file for deployment and click buttons on the page for stopping and starting the server, though I can't seem to find it now.