aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes html vs servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "html vs servlet" Watch "html vs servlet" New topic
Author

html vs servlet

Naveed Ali
Ranch Hand

Joined: Aug 30, 2002
Posts: 41
I have just created a small seperate web application (given to it a eperate context path in server.xml) for Tomcat 4.0 and Win2000. I can successfuly call my servlet but can't the html file. I want to load the html file first through URL and then call this servlet from html file. How can i do it??? I am sure how to call it from within html file atleast. The directory structure is,
servlet class placed in /application/WEB-INF/classes/classes
index.html placed in /application/
web.xml placed in /application/WEB-INF/
Are any changes required in web.xml file regarding index.html instead of servlet mapping etc.?? I have mapped servlet successfuly and is running.
The /application directory is under the /webapps directoy of Apache Tomcat installation directory.
Ivan Matmati
Ranch Hand

Joined: Feb 26, 2003
Posts: 41
Your html file should be called with http://host : port/context/index.html.
Have you tried this?What is your log saying then?
[ April 22, 2004: Message edited by: Ivan Matmati ]

No Gates!<p>SCPJ 1.4<br />SCWCD 1.4
Jawan Reshman
Greenhorn

Joined: Apr 01, 2004
Posts: 4
There are two solutions to your problem
1. (As suggested by Ivan Matmati in his reply).
Access your page as following.
http://<your host>:<your port>/context/index.html
2. Decalare in web.xml
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
and you your index.html will be displayed when accessed by
http://<yourhost>:<yourport>

Hope this helps.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: html vs servlet
 
Similar Threads
Running a servlet using Tomcat
Problem: Beans with JSP in Tomcat
Tomcat unable to find servlet in Shared linux java hosting Server
calling servlet
403- Forbidden error while accessing servlet