Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java Intro to Java Web Development with Spark Bells and Whistles Template Reuse and Static Resources

Jasper Peijer
Jasper Peijer
45,009 Points

IllegalArgumentException when trying to load the page

Once I included blocks and partials with the templating and tried to load the page it showed 500 Internal Server Error and "Caused by: java.lang.IllegalArgumentException: found 'null', expected 'partial's name'" in the console.

My code:

index.hbs

{{#partial "content"}}
    {{#if username }}
        <h1>Welcome {{ username }}</h1>
    {{ else }}
        <h1>Welcome Students!</h1>

        <form action="/sign-in" method="post">
            <input type="text" placeholder="What's your username?" name="username" />
            <button>Sign In</button>
        </form>
    {{/if}}
{{/partial}}

{{> base.hbs}}

base.hbs

{{#block "header"}}
    <!doctype html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>{{#block title}}Welcome to Course Ideas{{/block}}</title>
    </head>
    <body>
{{/block}}

{{#block "content"}}{{/block}}

{{#block "footer"}}
</body>
</html>
{{/block}}

1 Answer

saykin
saykin
9,835 Points

Line 6 in base.hbs is missing double quotes on title.

Jasper Peijer
Jasper Peijer
45,009 Points

Thanks I was almost sure it was going to be something stupid that I missed.