zoukankan      html  css  js  c++  java
  • Why jsp?

    Before the JSP come into the world . The CGI and servlet took the responsibility of generating dynamic content for Http Request.

    So why JSP? It there any reason for replacing CGI and Servlet ways with JSP ?

    For CGI and Servlet we knew the secret of dynamic content , It is that they can output the raw html to the client. 

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
                    .....
    		PrintWriter out=reponse.getWriter();
                    out.Println("<html>.......</html>");
                    ....
    	}
    

      So if there is a way to combine the html and java code into a Servlet class . It will be good. The developer can edit html for static content.

    and let java code to generate dynamic content. So the JSP was born. Actually the JSP will be compiled to a class. and the class is inheritted from HttpServlet. 

        

  • 相关阅读:
    控制流程
    表达式
    2020.2.7
    寒假自学进度六
    2020.2.6
    2020.2.5
    寒假自学进度五
    Scala初级实验
    寒假自学进度四
    Spark运行基本流程
  • 原文地址:https://www.cnblogs.com/malaikuangren/p/3635982.html
Copyright © 2011-2022 走看看