[ Team LiB ] Previous Section Next Section


The Workshop is designed to help you review what you have learned, and help you to further increase your understanding of the material covered in this hour.



If you do not declare the scope of a JavaBean, what scope will it have?


How does the jsp:setProperty action behave if you do not declare a value attribute?


How can you perform initialization of a JavaBean within a JSP?



The default scope for a JavaBean is page scope.


If you do not declare a value attribute, jsp:setProperty will assume that there is a request parameter whose name is the same as a declared property. If you have declared a param attribute, the value of the param attribute will identify the name of the request parameter whose value will be assigned to the property.


Instead of using a empty tag (<jsp:useBean/>) to declare a JavaBean, you can use a start (<jsp:useBean>) and an end (</jsp:useBean>) tag to enclose your initialization content. The content can include code or tags that work with the JavaBean you declared.


  1. Write a simple Web application that uses a form to populate a JavaBean in a JSP. Try both the GET and POST request methods.

  2. Create a JSP that uses a JavaBean that implements the nameable interface. The JSP should output the first and last name. Create two other JSPs that each forward to this page. For these pages, write separate JavaBeans that implement the nameable interface. Make the second JavaBean modify the characters of the first or last name. Invoke each page to demonstrate that the forwarded page is using the different JavaBeans.

    [ Team LiB ] Previous Section Next Section