Background: What Are Beans?
Classes that follow certain conventions
Must have a zero argument (empty) constructor
Should have no public instance variables (fields)
Persistent values should be accessed through methods 
called getXxx and setXxx
If class has method getTitle that returns a String, 
class is said to have a String property named title
Boolean properties use isXxx instead of getXxx
For more on beans, see 
http://java.sun.com/beans/docs/
57
JSP
www.corewebprogramming.com
Basic Bean Use in JSP
Format
Purpose
Allow instantiation of classes without explicit Java syntax
Notes
Simple interpretation: JSP action
 id="book1" class="cwp.Book" />
can be thought of as equivalent to the scriptlet
<% cwp.Book book1 = new cwp.Book(); %>
But useBean has two additional features
Simplifies setting fields based on incoming request
params
Makes it easier to  share beans
58
JSP
www.corewebprogramming.com
29




  

Home

About Services Network Support FAQ Order Contact
 

Java Web Hosting

Our partners:Jsp Web Hosting Unlimited Web Hosting Cheapest Web Hosting  Java Web Hosting Web Templates Best Web Templates PHP Mysql Web Hosting Interland Web Hosting Cheap Web Hosting PHP Web Hosting Tomcat Web Hosting Quality Web Hosting Best Web Hosting  Mac Web Hosting 

Lunarwebhost.net  Business web hosting division of Vision Web Hosting Inc. All rights reserved