• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

EL function

 
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is this mean that we can use a public class with public no-org contructor as a <function-class> ??
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 4109
72
Hibernate Fedora Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 336
Firefox Browser Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Hey cool! They got a blimp! But I have a tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic