![]() |
|
|
|
Java Server Pages JSP pages are just one way of implementing the concept of HTML pages with embedded code, or template pages. There are three mainstream technologies available for creating HTML with embedded code: PHP from Apache, Active Server Pages (ASP) from Microsoft, and JSP from Sun Microsystems. PHP and ASP, however, work only with proprietary Web servers. With JSP pages, Java technology code fragments are embedded in an HTML-like file. This code is executed at runtime to create dynamic content. All template page technologies have the same fundamental structure: an HTML page that a Web designer can easily create, with special tags, which indicate to the Web server that code needs to be executed at request-time. JSP pages are the opposite of servlets. Instead of Java technology code that contains HTML, template pages are HTML that contains Java technology code. JSP pages are converted by the Web container into a servlet instance. That servlet then processes each request to that JSP page. This feature of JSP pages is an advantage over other template page technologies because JSP pages are compiled into Java technology byte code whereas ASP (or PHP) pages are interpreted on each HTTP request. The JSP page runs as a servlet; everything that you can do in a servlet you can do in a JSP page. The main difference is that a JSP page should focus on the presentation logic of the Web application Because JSP pages are translated into Java servlets, JSP technology has all of the advantages of servlets:
The main disadvantage of JSP technology is that application logic is built into the JSP pages using scripting elements. Putting business logic in the JSP pages creates a poor separation of business logic from the presentation logic. However, you should use servlets and JSP pages together to achieve separation of concerns. |
| About Us | Contact Us | Disclaimer | Privacy Policy | ©2008 thewebguru.com |