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 7802241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:12:11+00:00 2026-06-02T01:12:11+00:00

I have an object like this public class Employee { public String getName() {

  • 0

I have an object like this

public class Employee {

  public String getName() {
    return "tommaso";
  }

  public String getName(String name) {
    return "tommaso "+name;
  }

}

In my action (I use Struts) I set a parameter of object Employee.

request.setAttribute("emp",employeeInstance);

After that in jsp I write this code

${emp.name}

and the output is

tommaso

If I want to use the second method, public String getName(String name) { ... }, using same formal text, ${emp. ...something passing a parameter... }, is possible?

  • 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-02T01:12:13+00:00Added an answer on June 2, 2026 at 1:12 am

    If you target at least a Servlet 3.0 container like Tomcat 7+, Glassfish 3+, JBoss AS 6+, etc with a web.xml conform at least Servlet 3.0 spec, then EL will let you invoke methods with arguments. Your particular case can then be solved as follows:

    ${emp.getName('foo')}
    

    If you aren’t on Servlet 3.0 yet or can’t upgrade to it, then you’d need to create a custom EL function which takes 2 arguments: the Employee and the name.

    public static String getEmployeeName(Employee employee, String name) {
        return employee.getName(name);
    }
    

    which you then use as follows:

    ${my:getEmployeeName(emp, 'foo')}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assume I have a business object like this, class Employee { public string name;
I have an object like this public class Employee { public int EmployeeId {
I'm just wondering .. I have and object like this public class Entry{ public
I have an object like this: public class MyObject{ public int Prop1 {get;set;} }
I have an object that looks something like this: public class Student { public
I have an object model like this: public class Quantity { public decimal Weight
I have a object structure like this: public class Entity { IList<Relationship> Relationships{get;set;} }
I have a ViewModel that looks like this: public class CreateReviewViewModel { public string
I have two class like this: public Class Company { public IList<Employee> Employees; }
If you have an object like this: public class Foo { private int _id;

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.