Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

doubt on jstl, invoke instance method

 
aleyx chow
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys, i v a question on jstl.
surely i can mapping a public static method to an el function.
but i wanna know is it possible to mapping an instance method to an el function and how can i fulfil it?
can sb give some reference for that? thanx a lot.
 
MInu
Ranch Hand
Posts: 517
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
while invoking a function using EL,the function must be static and public.
Non static methods(instance methods) cannot be able to invoke using EL.
Perhaps using your own custom tags will meet your requirment.

correct me if iam wrong...
 
aleyx chow
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Vinod , thanx for u reply.

it seems that i can't mapping instance method to el directly.

Maybe i could define a static method just like this:

static Object invokeMethod(String methodName,Object obj)

and this method could invoke the instance method of the param obj.then mapping it to el. and now i could make the isntance acting.

is it right? correct me if i m wrong...
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!