Wrapping Up Beans

I l @ ve RuBoard

It wouldn't be an overstatement to say that Java Beans are the key to making JSP work. They're the difference between a simple scripting language that lets you put programmatic content on a Web page and a programming environment that lets you leverage all the power of object-oriented design for your application.

Java Beans contain state, which is accessed using get and set methods on the Bean. They also have scope in JSP ”either page, request, session, or application. Different scopes allow the bean to persist for different amounts of time. jsp:useBean is used to associate a Bean with a name and a scope on a JSP page. jsp:setProperty is used to apply form values to a Bean. Singleton classes can be used to avoid creating multiple instances of an application-level Bean.

In the next chapter, which is the last chapter of pure JSP review, you'll look at servlets along with the request and response objects, which allow you to interact with the page servicing process at a microscopic level. Then you'll be ready to move on to the sample application.

I l @ ve RuBoard


MySQL and JSP Web Applications. Data-Driven Programming Using Tomcat and MySQL
MySQL and JSP Web Applications: Data-Driven Programming Using Tomcat and MySQL
ISBN: 0672323095
EAN: 2147483647
Year: 2002
Pages: 203
Authors: James Turner

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