I created one program that prints 'Welcome to our site' text on browser using servlet. It works fine inside the eclipse default browser but when I use that URL to other browser it displays text as below:
And below is the image of the code that is working well inside eclipse browser
And my code is as follows:
public class WelcomePage extends HttpServlet {
@Override
public void init() throws ServletException {
}
@Override
protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
PrintWriter out = res.getWriter();
out.println("<h3>Welcome to our site<h3>");
out.println("<form>");
out.println("</form>");
}
@Override
public void destroy() {
}
}
See Question&Answers more detail:os