S
Sameer
Hello,
I have the following servlet code:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloWorld extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.println("Hello World\n");
out.println("Hello World\n");
out.println("Hello World\n");
out.println("Hello World\n");
}
}
The first time I execute the servlet, it gives me the output:
Hello World Hello World Hello World Hello World
i.e. all the text in a single line.
Please note that no HTML code is embedded in the servlet.
The next time I refresh the same page, the output is:
Hello World
Hello World
Hello World
Hello World
Why this may be happening?
Please clarify.
I have the following servlet code:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloWorld extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.println("Hello World\n");
out.println("Hello World\n");
out.println("Hello World\n");
out.println("Hello World\n");
}
}
The first time I execute the servlet, it gives me the output:
Hello World Hello World Hello World Hello World
i.e. all the text in a single line.
Please note that no HTML code is embedded in the servlet.
The next time I refresh the same page, the output is:
Hello World
Hello World
Hello World
Hello World
Why this may be happening?
Please clarify.