aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Head First Sample Code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Head First Sample Code" Watch "Head First Sample Code" New topic
Author

Head First Sample Code

Anila Mathew
Ranch Hand

Joined: Jun 16, 2004
Posts: 69

Hi,

I am following the Head First Servlets and JSP for the exam.When i am trying to deploy a small MVC application (Chapter 3) in Tomcat, I am getting a resource not found error.

I have placed the form.html under both the deployment and development environment as specified in the text.Stll the form.html is not loaded.Please help

Thanks,
Anila Mathew
Edmund Yong
Ranch Hand

Joined: Nov 16, 2003
Posts: 164
Do you have a WEB-INF directory? I think you'll need that.


SCJP 1.2, SCWCD 1.4
Anila Mathew
Ranch Hand

Joined: Jun 16, 2004
Posts: 69

Yes, i have created a WEB_INF directory in D:\TomCat\webapps\DirectoryName
and also in D:\MyPrograms\DirectoryName\etc.
Edmund Yong
Ranch Hand

Joined: Nov 16, 2003
Posts: 164
How are you accessing the page? Did you enter the URL correctly? Should be:

http://localhost:8080/DirectoryName/form.html
Anila Mathew
Ranch Hand

Joined: Jun 16, 2004
Posts: 69

Yes, i am using the link http://localhost:8080/DirName/form.html. When i use http://localhost:8080, i am getting the tomcat home page
Darya Akbari
Ranch Hand

Joined: Aug 21, 2004
Posts: 1855
Hi Anila,

post your web.xml file here so we can all take a look on it.

Regards,
Darya


SCJP, SCJD, SCWCD, SCBCD
Rajesh Krishnan
Greenhorn

Joined: Jul 14, 2005
Posts: 9
The directory shd be WEB-INF and not WEB_INF.
Naresh Chaurasia
Ranch Hand

Joined: May 18, 2005
Posts: 356
Hi Anila,
I had also faced the similar problem many time. What i did was i created a copy of the existing directory under webapps and then renamed. It solved the problem for me. I guess i was having the problem because there was some mistake in my web.xml(but i could not figure out what, I hope the directory you are using is WEB-INF and not WEB_INF)

N C


SCJP 1.4, SCWCD1.4, OCA(1Z0-007)
Anila Mathew
Ranch Hand

Joined: Jun 16, 2004
Posts: 69

Hi all,

Honestly saying my web.xml is empty. I thought for just showing the html page it just need to have a text file named web.xml.

Can you tell what should be the content of the web.xml file?

Thanks all,
Anila
Darya Akbari
Ranch Hand

Joined: Aug 21, 2004
Posts: 1855
You tried it with an empty web.xml . Are you ...

Here an example how your web.xml can look:


<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
<servlet>
<servlet-name>Anila's Servlet</servlet-name>
<servlet-class>YOURServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Anila's Servlet</servlet-name>
<url-pattern>/Serv</url-pattern>
</servlet-mapping>
</web-app>


Regards,
Darya
Cai DongShan
Ranch Hand

Joined: Dec 07, 2004
Posts: 102
Yes, i have created a WEB_INF directory in D:\TomCat\webapps\DirectoryName
and also in D:\MyPrograms\DirectoryName\etc.


1. Is D:\TomCat\ your TomCat root directory?
2. If point 1 is correct, put form.html under d:\TomCat\webapps\DirectoryName.
3. Directory name should be WEB-INF, not WEB_INF.

Yes, i am using the link http://localhost:8080/DirName/form.html. When i use http://localhost:8080, i am getting the tomcat home page


You should use url http://localhost:8080/DirectoryName/form.html, not http://localhost:8080/DirName/form.html

You don't need web.xml to display form.html.


Best Regards,<br />DongShan<br /> <br />SCJP1.4, SCWCD1.4
Anila Mathew
Ranch Hand

Joined: Jun 16, 2004
Posts: 69

Hi Dongshan Cai,

Thanks a lot.Even i got confused whether you need a web.xml file to display just an html page.

My tomcat installation is in D:\Tomcat\Tomcat5.0

I have corrected the WEB_INF to WEB-INF.

My application directory name is Dolls and html is Doll.html.

I have placed this Doll.html in D:MyPrograms\Dolls\Doll.html

and also in D:Tomcat\Tomcat5.0\webapps\Dolls\Doll.html

Also D:\Tomcat\Tomcat5.0\webapps\Dolls\WEB-INF directory also

Regards,
Anila
Jason Liao
Ranch Hand

Joined: Jun 17, 2005
Posts: 59
Yes. You need a web.xml to display a simplest html page ( I tried in Tomcat5.5). Without it, you will get "resource not found error".

Bests,

Jason
Cai DongShan
Ranch Hand

Joined: Dec 07, 2004
Posts: 102
I removed web.xml and restart tomcat, then open the following page without problem.

http://localhost:8080/Beer-v1/form.html

I am using Tomcat 5.5.9 with J2SE 1.5.0_03-b07 on Windows XP.
Cai DongShan
Ranch Hand

Joined: Dec 07, 2004
Posts: 102
Anila,

Sorry for late reply. Have you solve the problem? Can you display the html page now?

Thanks a lot.Even i got confused whether you need a web.xml file to display just an html page.


You are welcome. I don't need web.xml file to display the html page. Please refer to my previous post.

My tomcat installation is in D:\Tomcat\Tomcat5.0

I have corrected the WEB_INF to WEB-INF.

My application directory name is Dolls and html is Doll.html.

I have placed this Doll.html in D:MyPrograms\Dolls\Doll.html

and also in D:Tomcat\Tomcat5.0\webapps\Dolls\Doll.html

Also D:\Tomcat\Tomcat5.0\webapps\Dolls\WEB-INF directory also


You can display Doll.html by using web page http://localhost:8080/Dolls/Doll.html
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Head First Sample Code
 
Similar Threads
Tomcat problem
accessing html file under tomcat
form.html not displayed
Help -unable to run servlet in APACHE
Can't run JSP/HTML files in Tomcat