Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7974365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:20:53+00:00 2026-06-04T08:20:53+00:00

How do I call an object’s method from EL? Give the object: public class

  • 0

How do I call an object’s method from EL?

Give the object:

public class TestObj {
   public testObj() { };

   public String test() { return "foo"; }
   public String someOtherMethod(String param) { return param + "_bar"; } 
}

and the obj is added to the pageContext

pageContext.setAttribute("t", new TestObj());

How would I perform the equivalent of:

<%= t.test() %>
<%= t.someOtherMethod("foo") %>

using EL?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T08:20:54+00:00Added an answer on June 4, 2026 at 8:20 am

    It’s supported since EL 2.2 which has been out since December 10, 2009 (over 2.5 years ago already!). EL 2.2 goes hand in hand with Servlet 3.0, so if you target a Servlet 3.0 container (Tomcat 7, Glassfish 3, etc) with a Servlet 3.0 compatible web.xml which look like follows

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app 
        xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
        version="3.0">
    
        <!-- Config here. -->
    
    </web-app>
    

    then you’ll be able to invoke methods with or without arguments in EL in the following forms:

    ${t.test()}
    ${t.someOtherMethod('foo')}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can I dynamically call an object method having the method name as a string?
Given an instantiated JavaScript object/class can I make an Ajax call from that class
I wish to create a call object from a string. alist() , which does
I am trying to call an object method from an object (the same object)
Is there a way in Python to call class object from function definition ?
When i call object.Dispose() ; Will CLR immediately destroy the object from memory or
What happens when you call notifyAll method on an object that is not waiting?
When I call as instance method of a class as follows : object_name.function_name(); how
If I have a method - (void) myMethod:(NSString *)string { [Object anothermethodWithString:string]; } and
Can we call thread_object.start() from within a constructor of this same object? Is this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.