Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help getting my first servlet to run.

Status
Not open for further replies.

csphard

Programmer
Apr 5, 2002
194
0
0
US
Help,


I compile the following servlet using Eclipse.

package sample;

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class HelloWorld extends HttpServlet {

public void doGet(HttpServletRequest request,
HttpServletResponse res)
throws ServletException, IOException {
res.setContentType("text/plain");
PrintWriter out = res.getWriter();
out.println("<html>");
out.println("<HEAD><TITLE>Hellow World</TITLE></HEAD>");
out.println("<body>");
out.println("This SHIT IS WORKING!!!!!!!!!!!!!!!!!!");
out.println("</body></html>");
}
}


I copied the class from the bin and copied that folder with the class into tomcat7

I copied the web.xml from tomcat7.

<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at


Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<web-app xmlns=" xmlns:xsi=" xsi:schemaLocation=" version="3.0"
metadata-complete="true">

<display-name>Welcome to Tomcat</display-name>
<description>
Welcome to Tomcat
</description>

</web-app>



It will not run and I am lost.

Tomcat is running. I test the jsp and servlets from tomcat 7 examples.

I am getting this error:

scription The requested resource (/webdev/HelloWorld) is not available.

Why is this not working?

Howard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top