user3253099
user3253099

Reputation: 91

Redirect in Play after POST Request to Play 2.3.x

I am new to play. I have a scenario like I need to redirect the request that I am getting to other url.

Can anyone help with sample code snippets with play apis that can be added in controllers class?

Upvotes: 2

Views: 571

Answers (1)

Peanut
Peanut

Reputation: 3963

To redirect to the index page use this:

Redirect(routes.Application.index)

Complete Example:

def foo() = Action {
   // handle your post-request stuff here....

   // Forward to index page (or somewhere else...)
   Redirect(routes.Application.index) 
}

Upvotes: 2

Related Questions