I successfully load the application(starting file = index.html) when i run tomcat 4 and enter the Url. But i am unable to call the servelt from index.html. What should be the solutions in following?
- Calling from a hyperlink. - Can i call it by using 'Form' or something like 'Action' from html file. - Is servlet-mapping necessary in above two cases. If yes then should i call the actual class or mapping class name.Plz insert a line or two of html code as an example.
Assuming the classes are in directory WEB-INF/Classes/Classes/
I have tried in various patterns but it returns error no. 404 while i can successfully load and run the servlets if i call it directly from Url wihtout using index.html.
No no no no - do NOT use the invoker servlet (implied by /servlet/) - it isn't even turned on in Tomcat 4 on. See the invoker servlet FAQ here at the ranchhouse. Nothing but confusion can come of relying on the invoker servlet to address a servlet. Bill
Can you point to a good doc on the xml configuration you showed? I've seen several examples and have one or two up & running in Tomcat/Eclipse but the entries don't make sense to me yet. Thanks!
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Joined: Aug 25, 2003
hope you have misunderstood. I have given only the <servlet> and <servlet-mapping> portion as an example. I presume, you have misunderstood because of the sentence "dd format". I did not mean the web.xml format.
hope it is clear now.
Joined: Aug 30, 2002
well, i have just missed one point that i have created new application by creating new directory 'application' under the 'webapps\ROOt\' dir. I have given the context path as '/application'. So the exact directory structure in my case is ROOT/application/classes/classes and not the previous one i had given. The WEB-INF dir is under the 'application' dir. I have packaged my servlet class in package named 'classes'. Here i am posting the mapping.
i had given '/classes/classes/Helloservlet2' in the hyperlink which gave me error 404.
Author and all-around good cowpoke
Joined: Mar 22, 2000
Well, webapps\ROOT is already a web application - it has a WEB-INF and web.xml etc. You can't create another web application under ROOT, you must create it under webapps. Assuming your application name is application and your servlet is in the "classes" package and the servlet class name is indeed "servlet2" like it says in your web.xml, your directory structure should be: