8

Is it possible to pass a parameter to the method which is being defined in controller, and called by tml ?

tml

${getDynamicFieldValue("Subject")}

java

public String getDynamicFieldValue(String fieldToCompare) 
{
    //Logic
}

Exception

Could not convert 'getDynamicFieldValue("Subject")' into a component parameter binding: Error parsing property expression 'getDynamicFieldValue("Subject")': Unable to parse input at character position 22.
Nirmal
  • 4,789
  • 13
  • 72
  • 114

2 Answers2

14

Sure, it is possible. However, you must use single quotes around string literals:

${getDynamicFieldValue('Subject')}

Check the documentation for more information on property expressions.

Martin
  • 37,119
  • 15
  • 73
  • 82
  • Is it possible to pass more than one parameter to the method ? According to my experience, it's not. – galeop Apr 30 '14 at 14:55
1

Yes, it is possible to pass multiple arguments.

${getDynamicFieldValue('Subject', 'Object')}

where you have a method public String getDynamicFieldValue(String arg1, String arg2) ...

Charles Roth
  • 798
  • 5
  • 8