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

missgeekbunny
missgeekbunny
37,033 Points

Thyme can't parse my file path

I've been trying to follow along with the spring class but I've been making modifications to make the program fit my needs. I've actually been trying to create a site that hosts images similar to their gif library. However I don't want to limit all image formats to gifs though. Can you guys help me figure out why thyme and spring can't parse this? A note: my customizations are to have the variable called img instead of gif and to add the extension as a private string in the class.

    <img th:src="@{'img/' + ${img.mName} + '.' + ${img.mExtension}" th:alt="${img.mName}" />

1 Answer

missgeekbunny
missgeekbunny
37,033 Points

I found an answer to my own question. I just needed to string them together and add a curly brace.

    <img th:attr="src=@{'img/' + ${img.mName} + '.' + ${img.mExtension} alt=${img.mName}}" />