Thursday, April 14, 2011

Quick Recap: Chapters 38 to 43

Let us quick recap what we learnt about JavaBeans in the previous few chapters.

Introduction to JavaBeans:

• JavaBeans used in JSPs are totally different from Enterprise Java Beans or EJBs
• JavaBeans are regular Java classes that have a public no-arg constructor and getter/setter methods for all the variables declared in the class

Using JavaBeans:

• JavaBeans can be used inside JSPs using the jsp:useBean tag
• The attributes that can be set in the jsp:useBean are: id, scope, class, beanName and type
• You can modify the attributes of a Bean using the setProperty and getProperty actions

JavaBean Scope:

• JavaBeans can have 4 scopes: page, request, session and application
• Page is the least visible and is available only in the current JSP
• Beans declared with scope as Request are visible to all JSPs and Servlets that share the current Request
• Beans declared with Session scope are visible to all JSPs and Servlets that are accessed by a single user session
• Beans declared with Application scope are visible to all JSPs and Servlets that share the current Servlet Context – across user sessions

Key Terms Learnt in this Chapter:

• JavaBean
• Bean properties
• XML
• Bean scope and attributes
• get/set method pairs

Previous Chapter: Chapter 43 - Accessing JavaBeans in JSP

Next Chapter: Self Test - Chapters 38 to 43

No comments:

Post a Comment

© 2013 by www.inheritingjava.blogspot.com. All rights reserved. No part of this blog or its contents may be reproduced or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without prior written permission of the Author.

ShareThis

Google+ Followers

Followers