小编B_A*_*ode的帖子

why html tags are not working inside servlet?

I'm new to Servlets I just trying to print a simple Html tag inside servlet response but I dunno why it doesn't print in Browser. it just print the String without getting the Html tags.

Here is the code:

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("Hi All");
        PrintWriter out =response.getWriter();
        out.println("<h2>Please complete our Customer Survey</h2>");

    }

}
Run Code Online (Sandbox Code Playgroud)

**Out Put print as **

<h2>Please complete our Customer Survey</h2>
Run Code Online (Sandbox Code Playgroud)

Please let me know how to fix this Thanks.

html java servlets httpresponse

1
推荐指数
1
解决办法
947
查看次数

标签 统计

html ×1

httpresponse ×1

java ×1

servlets ×1