Experiencing Java

Sunday, October 22, 2006

Book: Beginning Java Server Pages

Why Reading This Book?
I was asked how to create a simple web access to database and present it in a html page. The answer is by using a servlet which will take care of the GET and POST command, as well as accessing the database. Servlet, that is it. By reading this book I hope to find out more about.
Also, this book contains two projects: (1) Personalized Portal and (2) Shopping Cart Application.
It sounds good, isn't it? Well, at least something useful :)

What Do I Learn From This Book?
  • I have just been introduced to the Tags. I think it has a lot of potentials. Let's see.
  • How to show which browser the user is currently using:
    • Create a tag consisting this: ${header["user-agent"]}
  • JSTL(JSP Standard Tag Library): support for common, structural tasks such as iteration and conditionals, tags for manipulating XML documents, internationalization tags, and SQL tags
  • (31/10/06):
    • Implement an interactive catalog showing categories of products
    • Implement a working shopping cart
    • Use Java objects as attributes to pass information between JSP elements or multiple JSP pages
    • Use implicit JSP objects that support attachment of attributes, and the lifetime of these implicit objects
    • Scoping
    • Session

What Have I Done?
  • I now already installed Apache Tomcat server. (Yoohoo!!)
    • Previously it was version 5.5.16 --> problem running JSP examples
    • Installed the latest version 5.5.20. In the installation process apparently there is an option to deploy the JSP examples and Servlet examples. AKA install full.
    • May be I didn't do that with my previous installation

Good Points and Quotations:
  • JSP is a presentation-layer technology (p.28)
JSP Best Practices:
  1. Use the simplest HTML to prototype your application before adding style and layout
  2. Separate JSP development from HTML layout and formatting as possible.
  3. Pattern: Attaching an attribute to an (implicit) object --> in the declaration part, to be retrieved during processing by the JSP. (p.86)
    getServletContext().setAttribute("cats", EShop.getCats());
    Later,
    ArrayList cats = (ArrayList) application.GetAttribute("cats");

0 Comments:

Post a Comment

<< Home