Page #480 (35.7. Using JavaBeans in JSP)

 
[Page 1222 ( continued )]

35.8. Getting and Setting Properties

By convention, a JavaBeans component provides the get and set methods for reading and modifying its private properties. You can get the property in JSP using the syntax shown below:

   <jsp:getProperty name   =   "beanId"   property =   "sample"   />   

This is equivalent to

   <%=   beanId.getSample()   %>   

You can set the property in JSP using the following syntax:

   <jsp:setProperty name   =   "beanId"     property   =   "sample"   value   =   "test1"   />   


[Page 1223]

This is equivalent to

   <%   beanId.setSample(   "test1"   );   %>   

 


Introduction to Java Programming-Comprehensive Version
Introduction to Java Programming-Comprehensive Version (6th Edition)
ISBN: B000ONFLUM
EAN: N/A
Year: 2004
Pages: 503

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