Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tapestry - Passing Parameters to method from tml

Tags:

java

tapestry

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.
like image 207
Nirmal Avatar asked May 12 '11 11:05

Nirmal


2 Answers

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

${getDynamicFieldValue('Subject')}

Check the documentation for more information on property expressions.

like image 106
Martin Avatar answered Sep 30 '22 19:09

Martin


Yes, it is possible to pass multiple arguments.

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

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

like image 28
Charles Roth Avatar answered Sep 30 '22 18:09

Charles Roth