• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EL function

 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please consider the qoestion from HFSJ 1 edition mock.

Given an existing class:


Which are true about EL functions? (Choose all that apply.)

A. The MyFunctions class may NOT be used by EL because it has NOT been declared final.
B. The funct method may be used by EL because it has been declared static.
C. The funct method may NOT be use by EL because the calling arguments and return value must be object references.
D. The modX method may be used by EL because it is an instance method.
E. The MyFunctions class may be used by EL even though it has a public constructor.

correct options are in bold. I wonder if E would be correct one. Because to use as a EL function , block should be declared as public and static.
i think i am badly confused.
 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this mean that we can use a public class with public no-org contructor as a <function-class> ??
 
Rakesh Lakshminarayan
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


The option B is correct because we can use the public static function to call from jsp using EL

The option E is correct because , even though the class has a no-arg public constructor , we are going to call only the static method within it . We are not going to create any instance of the class. So it is legal to use the so said class.

Ranchers , please correct me if I am wrong.

Rakesh
 
Vijitha Kumara
Bartender
Pie
Posts: 3930
21
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because to use as a EL function , block should be declared as public and static.


Only the methods (which will be used as EL functions) should be public static.
 
Milton Ochoa
Ranch Hand
Posts: 336
Firefox Browser Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, I have another question.

If this class have a construct with argumts, will be a problem? I think that no. because, like said Rakesh. we are not instancing the class, only using statics methods!

correct me if I am wrong.

Very thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic