Two Laptop Bag
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Objectives 10.3 WHAT WE HAVE TO DO HERE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Objectives 10.3 WHAT WE HAVE TO DO HERE" Watch "Objectives 10.3 WHAT WE HAVE TO DO HERE" New topic

Objectives 10.3 WHAT WE HAVE TO DO HERE

Ranch Hand

Joined: Nov 22, 2001
Posts: 110
10.3 Identify techniques that access a declared JavaBean component.
The Answer From the Notes is :-
A declared JavaBean can also be accessed using: (the name specified in the id attribute of <jsp:useBean>
. Scriptlets
. Expressions
. Custom Tags
But i couldn't understand if Someone plz tell me.

Muhammad Hussain<br />Sun Certified Java Programer (SCJP2)<br />Sun Certified Web Component Devloper SCWCD
Victor Htet
Ranch Hand

Joined: Apr 09, 2000
Posts: 70
Pls. refer to JSP 1.2 spec page 70 , Semantics of jsp:useBean actions

Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

On my test, I received a bunch of questions in this area, plus it was one of the two areas I did the worst. So read the specs, like posted above, and try it out in real code. Try all the different ways to use the usebean. I think you will find it very helpful. I wish I could help more, but I still need more work in this area myself

Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
Anthony Villanueva
Ranch Hand

Joined: Mar 22, 2002
Posts: 1055
A scriptlet is Java code enclosed within <% %> tags. An expression is similar to a scriptlet, except the expression inside its <%= %> tags must return a value. A custom tag is a user-defined tag. Its functionality is defined by a Java class known as a tag handler class.
Your JavaBean (or is it JavaBean(tm)? ) reference is treated just like any other object reference within the tags. You can invoke methods on it, whatever. For example:
<jsp:useBean id="myBean" class="SomeBeanClass" />
<% for (int i=0; i<myBean.getSomeValue(); i++) {
} %>
Total bean value: <%= myBean.getTotalValue() %>
Denis Duan

Joined: Jan 09, 2009
Posts: 2
From the spec JSP 2.0 (page 1-99)

"A jsp:useBean action associates an instance of a Java programming language
defined within a given scope and available with a given id with a newly
declared scripting variable of the same id."

It helps clear the concept!!!

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63858

Denis Duan, please avoid posting to 6-year old posts. Please read this for more information.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Objectives 10.3 WHAT WE HAVE TO DO HERE
It's not a secret anymore!