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

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}}" />