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 trialRicardo Sala
16,212 PointsCould not parse as expression
With this code:
<!--/*@thymesVar id="favorite" type="java"*/-->
<!--/*@thymesVar id="gif" type="java"*/-->
<a href="#" th:class="(${gif.favorite} ? 'un':'')'mark favorite'"></a>
*See please at the end
I am getting this error:
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Thu Aug 17 10:05:43 CEST 2017 There was an unexpected error (type=Internal Server Error, status=500). Could not parse as expression: "(gif.favorite ? 'un':'')'mark favorite'" (gif-details:55)
*I do not know what those comments are, Intellij is asking for them, it removes the the error (red highlight) for the 'gif' word, but not for the 'favorite' word. It seems like I missed sthg here...
1 Answer
Boban Talevski
24,793 PointsI guess you figured it out by now, but just in case: you are missing a plus sign between the ternary operator and the 'mark favourite' literal :)
<a href="#" th:class="(${gif.favourite} ? 'un' : '') + 'mark favorite'"></a>