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 trialKevin Michie
6,554 Pointsgif.favorite creates an error
adding this statement:
<a href="#" th:class="(${gif.favorite} ? 'un' : '') + 'mark favorite'"></a>
produces this error:
There was an unexpected error (type=Internal Server Error, status=500). Exception evaluating SpringEL expression: "gif.favorite" (gif-details:50)
2 Answers
Tomas Svojanovsky
26,680 PointsI don't know why it works. I think you missed @ sign, because I had the same problem, I just compared with img tag and found the difference.
Example:
<a href="#" th:class="@{${gif.favorite} ? 'un' : ''} + 'mark favorite'"></a>
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 PointsIf it is still relevant...
Check your getter name for favorite
property. It should be public boolean isFavorite()
. This way error will be removed. If you have this getter right though, please paste your Gif class and errors in log of Intellijidea (there should be more information, especially Thymeleaf error).