Omid Monshizadeh
Omid Monshizadeh

Reputation: 1534

Does Spring has something like Play #{extends}?

#{extends} is very helpful and easy to use in Play framework to extend layouts and manage layouts in views, but I'm wondering if Spring also has something similar to this?

I'd really appreciate if anyone has same kind of code for Spring.

In following Play example I am extending main.html by index.html which means index.html will use main.html as its layout:

/* views/main.html : */
<!DOCTYPE html>
<html>
    <head>
        ...
    </head>
    <body>
        ...
        <div id="content">
        #{doLayout/}
        </div>
        ...
    </body>
</html>


/* views/Application/index.html : */
#{extends "main.html"/}
<h1>Home</h1>
...

Upvotes: 0

Views: 363

Answers (1)

Gelin Luo
Gelin Luo

Reputation: 14373

If you are using Velocity, read http://sebastienayotte.wordpress.com/2009/03/20/using-velocity-layout-in-spring/

If you use freemarker, see http://richardbarabe.wordpress.com/2009/03/19/freemarker-a-brief-example/

If you want the behaviour exactly like play's groovy template, you can try Rythm template engine, read this and this.

Upvotes: 1

Related Questions