1 2 Previous Next 19 Replies Latest reply on Aug 24, 2002 12:38 PM by Marcia Hostetler

    can't run my hello servlet on jboss

    Ben Newbie

      I'm having difficulity running simple hello servlet on jboss 3.0 but runs fine on tomcat 4 (as a test reslult for forte ide).

      The following is my hello servlet,


      import javax.servlet.*;
      import javax.servlet.http.*;

      public class hello extends HttpServlet {

      public void init(ServletConfig config) throws ServletException {
      super.init(config);

      }
      public void destroy() {

      }

      protected void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, java.io.IOException {
      response.setContentType("text/html");
      java.io.PrintWriter out = response.getWriter();

      out.println("");
      out.println("");
      out.println("Servlet");
      out.println("");
      out.println("");

      out.println("<h1>hello world java servlet</h1>");

      out.println("");
      out.println("");

      out.close();
      }
      }


      And here is the web.xml,

      <?xml version="1.0" encoding="UTF-8"?>

      <!DOCTYPE web-app
      PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
      "http://java.sun.com/dtd/web-app_2_3.dtd">

      <web-app>


      <servlet-name>helloServlet</servlet-name>
      <servlet-class>hello</servlet-class>


      <servlet-mapping>
      <servlet-name>helloServlet</servlet-name>
      <url-pattern>/hello.html</url-pattern>
      </servlet-mapping>

      <session-config>
      <session-timeout>30</session-timeout>
      </session-config>

      </web-app>


      I did deploy the war file into server/default/deploy directory. Where went wrong, please help.

      regards

        1 2 Previous Next