Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8042819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:42:48+00:00 2026-06-05T04:42:48+00:00

When a new app is created, two views are main.html and index.html. main is

  • 0

When a new app is created, two views are main.html and index.html. main is never explicitly rendered, it is extended as

#{extends 'main.html' /}

How do I pass a variable to a view (main.html), when its only extended from another view (index.html)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T04:42:51+00:00Added an answer on June 5, 2026 at 4:42 am

    If it is passed to the render method, it will be available as per normal. The entire view, including extends and includes are rendered by the Groovy template engine.

    However, in the case of the main.html which is usually extended on every view, the best option is to always add it to the renderArgs map using the @Before annotation, as follows. This ensure that it is always available, and you Do Not Repeat Yourself (DRY).

    @Before
    private void setup() {
        renderArgs.put("somekey", "somevalue");
    }
    

    This way, you don’t need to pass somekey into the render method on every render call.

    Then, in your main.html, you can access somekey simply using the standard method of $somekey.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

so I just created a new app that is references an older app of
I just created a new rails app in Rails 3.1.1, and my application layout
I have a NavigationBar app with two views: a parent and a sub view.
I've created a custom button in my Android app that has basically two different
From a previous FB SO question, I worked out that the Create New App
Since http is stateless, every request to an app creates a new object. How
I have been working on test framework, which creates a new app domain to
I'm running play2 on a 512M vps. It can create a new app: play
I can create new Silverlight App with .NET RIA Services enabled. But when I
I create a new Django app (not project) called Bussinesses, then add following class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.