Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error 500 and error 404

 
jay thakkar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • 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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic