[2.0] What's the difference between apply() and render() ?

47 views
Skip to first unread message

Jostein Austvik Jacobsen

unread,
Apr 12, 2012, 8:21:06 AM4/12/12
to play-fr...@googlegroups.com
What's the difference between

return ok(views.html.Application.index.apply());

and

return ok(views.html.Application.index.render());

?

Regards
Jostein

Guillaume Bort

unread,
Apr 12, 2012, 8:26:17 AM4/12/12
to play-fr...@googlegroups.com
It is the same. apply() is the standard for Scala functions, you can
use views.html.Application.index() instead of
views.html.Application.index.apply()

For Java I preferred have a render() method instead. But it is the same.

> --
> You received this message because you are subscribed to the Google Groups
> "play-framework" group.
> To post to this group, send email to play-fr...@googlegroups.com.
> To unsubscribe from this group, send email to
> play-framewor...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/play-framework?hl=en.

--
Guillaume Bort

Pascal Voitot Dev

unread,
Apr 12, 2012, 8:27:07 AM4/12/12
to play-fr...@googlegroups.com
Apparently this is just an alias

    def render(title:String,content:Html) = apply(title)(content)


apply uses a curried form and render a classic function call...

Pasca

On Thu, Apr 12, 2012 at 2:21 PM, Jostein Austvik Jacobsen <jost...@gmail.com> wrote:
return ok(views.html.Application.index.render());

?

Regards
JosteinIs

Jostein Austvik Jacobsen

unread,
Apr 12, 2012, 8:41:34 AM4/12/12
to play-fr...@googlegroups.com
I see. That's what I suspected. Thanks :)

Jostein


2012/4/12 Pascal Voitot Dev <pascal.v...@gmail.com>
Reply all
Reply to author
Forward
0 new messages