Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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.