Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Objectives 10.3 WHAT WE HAVE TO DO HERE

 
Hussain
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Victor Htet
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pls. refer to JSP 1.2 spec page 70 , Semantics of jsp:useBean actions
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Mark
 
Anthony Villanueva
Ranch Hand
Posts: 1055
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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++) {
myBean.doesOtherStuff();
} %>
Total bean value: <%= myBean.getTotalValue() %>
<!--etc-->
regards,
Anthony
 
Denis Duan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the spec JSP 2.0 (page 1-99)

"A jsp:useBean action associates an instance of a Java programming language
object
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
Marshal
Pie
Posts: 65225
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Denis Duan, please avoid posting to 6-year old posts. Please read this for more information.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic