Day 5. Writing JavaServer Pages (JSP)

You spent the past two days learning the basic and advanced features of Java servlets and writing and deploying Java servlets in WebLogic Server. JavaServer Pages is the next technology supported by WebLogic Server that you will be studying today. JavaServer Pages, or JSP, as it is more popularly called, enables developers to embed Java code within an HTML page.

Over the next two days, you will be focusing on JavaServer Pages. You will be studying the basics of JavaServer Pages, such as the different tags supported in the JSP 1.2 specification, implicit variables available for developers in JSP, concepts of JSP tag libraries, and using the tag libraries available in WebLogic Server. As always, in each day's session, you will build a sample application that demonstrates the use of the technology being learned, in this case JSP.

Before you look at the technology of JSP, here is why JavaServer Pages were introduced in J2EE. From your previous two days of work on Java servlets, you should realize that servlets were the most efficient way to process data submitted by a user using an HTML form. But generating the output page may have been more work than you expected. All the HTML code for the response page was contained in the servlet and printed directly using the out.println(...) statement. This tight integration of HTML code in the Java servlet makes maintenance a pain.

Any changes that need to be made to the UI would have to be made by editing the servlet code (the writeHeaderZone() and other methods of the BookShoppingServlet) and recompiling and redeploying the servlet. In the production environment of a real-life application, this is not feasible. Hence, JSP technology was introduced to isolate the HTML code from the Java code by enabling developers to embed Java statements with special tags in the HTML code. This allows easy maintenance of the HTML UI.

JSP provides the flexibility to develop Web applications quickly and easily, flexibility that is not evident in Java servlets. More importantly, JSP allows Web application developers to separate the content and business logic from the look and feel of the application. This enables two types of developers to contribute to the Web application process: the UI developer, who develops the look and feel of the application, and the Java developer, who writes the actual processing logic of the application.



Sams Teach Yourself BEA WebLogic Server 7. 0 in 21 Days
Sams Teach Yourself BEA WebLogic Server 7.0 in 21 Days
ISBN: 0672324334
EAN: 2147483647
Year: 2002
Pages: 339

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net