How can I call a method in one of my controller classes without grails trying to generate a view?
Share
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 redirect to another controller action.
At some point you should either write to the response or redirect to a method/closure that corresponds to a view so the user can receive the output.
If the method you’re trying to call is on another controller, chances are YOAR DOING IT WRONG.
If, for example, I have a controller method that uploads a file, and another method that creates the filename for that file as a combination of some convention I make up (say timestamp + “pretty file for” + username) on another controller, you should promote that controller method to a Service and inject it into both controllers.