DyK
DyK

Reputation: 249

How to get the current page URL in the view?

I want to use URL of current page in all my pages on my site for creating link button.

I can do the following in my controller:

Http.Request.current().getBase() + Http.Request.current().url;

But how can I do this in view? Is there direct way?

Upvotes: 8

Views: 8195

Answers (1)

Codemwnci
Codemwnci

Reputation: 54924

You can access the Http.Request.current() in the view, as simply request.

So, you need

${request.getBase()}${request.url}

Upvotes: 15

Related Questions