• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

error 500 and error 404

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi guys i m jay and i m so new to servlet just started about 6 7 days before....

first i was successfully able to run servlet in xp... but now i sometimes get error 500 and sometimes i get error 404...

i m trying first simple helloworld.java example whish is in c:\program files\apache-tomcat-7.0.39\webapps\root

i compiled it and copied its .class file in c:\program files\apache-tomcat-7.0.39\webapps\root\WEB_INF\classes

the "classes" subdirectory in WEB-INF was not ther in but i made it as per i was instructed to do...

CODING is as below

helloworld.java

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

public class helloworld extends HttpServlet
{
private String message;

public void init() throws ServletException
{
//message="hello world";
}

public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException, IOException
{
res.setContentType("text/html");
PrintWriter out = res.getWriter();
out.println("<h1>helloworld</h1>");
}

public void destroy()
{

}
}

web.xml

<servlet>
<servlet-name>helloworld</servlet-name>
<servlet-class>Helloworld</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>helloworld</servlet-name>
<url-pattern>/helloworld</url-pattern>
</servlet-mapping>

please please help me quickly i m having xams soon... and more importantly i want to learn this thing deeply... ne good book to learn servlets deeply in your mind??? please share it .. thanks in advance.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you worked through the instructions in the ServletsFaq on this very issue?

One of the things you'll need to do is to put the class in a package other than the default. See the FAQ entry for more information.
reply
    Bookmark Topic Watch Topic
  • New Topic