3 JavaServer Pages:
While Java servlets are a big step up from CGI programs, they are not a panacea. To generate the response, developers are still stuck with using println statements to render the HTML. Code that looks like: out.println("<P>One line of HTML.</P>"); out.println("<P>Another line of HTML.</P>"); is all too common in servlets that generate the HTTP response. There are libraries that can help you generate HTML, but as applications grow more complex, Java developers end up being cast into the role of HTML page designers.
Meanwhile, given the choice, most project managers prefer to pide development teams into specialized groups. They like HTML designers to be working on the presentation while Java engineers sweat the business logic. Using servlets alone encourages mixing markup with business logic, making it difficult for team members to specialize.
To solve this problem, Sun turned to the idea of using server pages to combine scripting and templating technologies into a single component. To build Java Server Pages, developers start by creating HTML pages in the same old way, using the same old HTML syntax. To bring dynamic content into the page, the developer can also place JSP scripting elements on the page. Scripting elements are tags that encapsulate logic that is recognized by the JSP. You can easily pick out scripting elements on JSP pages by looking for code that begins with <% and ends with %>.
To be seen as a JSP page, the file just needs to be saved with an extension of .jsp. When a client requests the JSP page, the container translates the page into a source code file for a Java servlet and compiles the source into a Java class file—just as you would do if you were writing a servlet from scratch. At runtime, the container can also check the last modified date of the JSP file against the class file. If the JSP file has changed since it was last compiled, the container will retranslate and rebuild the page all over again.
Project managers can now assign the presentation layer to HTML developers, who then pass on their work to Java developers to complete the business-logic portion. The important thing to remember is that a JSP page is really just a servlet. Anything you can do with a servlet, you can do with a JSP
原文的翻译
JSP技术和JSP应用程序框架的概述
1、 jsp的优点
JSP被转换成servlet。所以,基本上,这个jsp可以完成任何任务,当然也可以通过servlet来完成。但是,这个所谓的等价并不表明servlet和JSP页面也同样适用于所有方面。这个问题不是技术所能解决的。这是方便,效率和可文护性的一个或另一个。毕竟,每一个特定的电脑上可以做平台的Java编程语言同时也能用汇编语言。然而,它仍然是非常重要的。你选择在servlet上独自运用JSP有下面好处:论文网
更易于编写和完善HTML。HTML不是动态的:木有过剩的反斜杠和双引号,没有潜在的Java。
- 上一篇:门诊预约系统英文文献和中文翻译
- 下一篇:SQL Server数据库英文文献和中文翻译
-
-
-
-
-
-
-
电站锅炉暖风器设计任务书
十二层带中心支撑钢结构...
酸性水汽提装置总汽提塔设计+CAD图纸
java+mysql车辆管理系统的设计+源代码
当代大学生慈善意识研究+文献综述
乳业同业并购式全产业链...
大众媒体对公共政策制定的影响
杂拟谷盗体内共生菌沃尔...
中考体育项目与体育教学合理结合的研究
河岸冲刷和泥沙淤积的监测国内外研究现状