Tapestry - Passing Parameters to method from tml
Asked Answered
B

2

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.
Blacken answered 12/5, 2011 at 11:49 Comment(0)
M
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.

Monsignor answered 12/5, 2011 at 12:58 Comment(1)
Is it possible to pass more than one parameter to the method ? According to my experience, it's not.Lesbianism
S
1

Yes, it is possible to pass multiple arguments.

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

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

Swellhead answered 24/2, 2015 at 19:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.