How can I get the value of el expression dynamically in an controller. For eq.
class ElController {
def index() = {
def a = "\${1 + 3}"
unknownElEvaluator(a) // ->"2"
....
}
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
You can do that with the Groovy SimpleTemplateEngine:
Though it would be interesting to know why you’d be doing this in a controller…
Alternatively, you should be able to add:
To your controller (or preferably as separate Service class, as you may end up wanting to do this from more than one place in your code)
Then, from inside the method, do: