[ Team LiB ] Previous Section Next Section

Summary

As you can see, JSPs make it easier to take advantage of JavaBeans. In most cases, using JavaBeans with JSPs produces code that is simpler.

To use JavaBeans, you only need to master three standard actions: jsp:useBean, jsp:getProperty, and jsp:setProperty. The jsp:useBean action makes a bean available for use in a JSP. The jsp:getProperty and jsp:setProperty actions allow you to access and set bean properties. JSPs have several shortcut mechanisms so that you can set bean properties with the values of request parameters easily. When we revisited the shopping cart example from Hour 13, we found that we could reduce the amount of code required in the JSPs and even replace the servlets with JSPs that worked with the JavaBeans that implemented the data objects.

    [ Team LiB ] Previous Section Next Section