Hello all! JSP is working good from my application directory on the test pages that I've made, servlets are not so good. I'm running Tomcat as a standalone server with port 8080. The servlet, just a simple helloworld out of the examples, is being executed with the following url: http://localhost:8080/MyTest/servlet/srv.HelloWorld. It appears to execute on the doGet method but no text is displayed on the browser page. The logs reflect nothing errored/excepted. All I get is a blank browser window. Please help if you can. I'm using ANT for the build with this directory structure under webapps folder: MyTest bin etc javadoc lib web src WEB-INF classes lib The web.xml in WEB-INF looks is the following: <!DOCTYPE web-app (View Source for full doctype...)>
<display-name>Joe Testing</display-name> <description>This is a simple web application with a source code organization based on the recommendations of the Application Developer's Guide.</description> </web-app> The code for the pgm is: package srv; import java.io.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; /** * Insert the type's description here. * Creation date: (3/15/2001 3:09:07 PM) * @author: */ public class HelloWorld extends HttpServlet { /** * HelloWorld constructor comment. */ public HelloWorld() { super(); } public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("<html>"); out.println("<body>"); out.println("<head>"); out.println("<title>Hello World!</title>"); out.println("</head>"); out.println("<body>"); out.println("<h1>Hello World!</h1>"); out.println("</body>"); out.println("</html>"); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { this.doGet(request, response); } /** * service method comment. */ public void service(ServletRequest arg1, ServletResponse arg2) throws ServletException, IOException {} } |
