I have this web page on which I clicked the web link:
http://localhost:8080/example/servlet/MyServlet
I have MyServlet.java compiled and MyServlet.class is in the
WEB-INF\classes folder.
I am expecting a html page generate by the servlet,
but all I got was a blank page. Whats is incorrect?
Here is the servlet:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class MyServlet extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse
resp)
throws IOException, ServletException
{
resp.setContentType("text/html");
PrintWriter out = resp.getWriter();
out.println("<HTML><HEAD><TITLE>My Page</TITLE></HEAD>");
out.println("<BODY>");
out.println("<P>");
out.println("test");
out.println("</P>");
out.println("</BODY></HTML>");
out.flush();
}
public void doPost(HttpServletRequest req, HttpServletResponse
resp) throws ServletException, java.io.IOException
{
doGet(req,resp);
}
}
--
To unsubscribe, e-mail: <mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>