Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Info on objective 10.3

 
Jim Bertorelli
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It says: Identify techniques that access a declared JavaBean component.
How is it different that 10.1 which talks about getProperty and setProperty?
Any idea?
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How is it different that 10.1
Hint:
How do you call a method (say printMe() )declared in a bean class, assuming you have access to it.
regds.
- satya
 
Jim Bertorelli
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<jsp:useBean id="abc" .../>
<%
...
abc.methodX();
...
%>
Is this what you mean? But a bean is not supposed to be used this way.
 
Manjunath Subramanian
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think 10.3 refers to the various attributes of a <jsp:useBean> tag like id,class,type,beanName.
As the statement indicates ,it refers to
1)the need to know the different ways of creating and using a JavaBean component.
2)to understand constraints like we cannot use "class" and "beanName" attributes together in a <jsp:useBean> tag and so on..
Hope this helps,
Manjunath
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Is this what you mean?

I was thinking yes.
But a bean is not supposed to be used this way.
Michell's notes says,

A declared java bean can also be accessed using:
scriptlets
Expressions
Custm Tags

And sure the code you posted is a scriptlet.
So yes. IMO, the issue is not whether you are supposed or not?
It is "Can you access the bean like this or can't you?"
My answer is "Yes, JSP allows such access."
Other thoughts please.....
Thanks.
- satya
 
Axel Janssen
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't expect that exam is about good programming practice. So I will try to take every possibility into consideration. If its possible to access JavaBean method by scriptlet I will mark it, although its bad programming practice.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic