user1140633
user1140633

Reputation: 103

How to call a action in other controller

I'm working on a play framework project, and I'm wondering whether there is any way to call an action from other controller. Redirecting is not the solution because these are 2 pages with different url (but the logic action is the same).

Anyone got a clue. So pleased if you can give me a hint to do this

Thanks

Upvotes: 0

Views: 101

Answers (1)

Pere Villega
Pere Villega

Reputation: 16439

If they are 2 different actions in 2 different pages and you want to chain them, redirection is the standard way. If you can't because that would move the user out of an area of the application, then you may need to reconsider if your design is right. Maybe you shouldn't have only 2, but a 3rd page, or something else.

If they are 2 pages with common code, then create a 3rd class with the common code and call as required.

Upvotes: 1

Related Questions