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 Spring Basics Modeling, Storing, and Presenting Data Using @PathVariable to Create a Dynamic Detail Page

Elias Carmona
Elias Carmona
9,097 Points

Where does the gif.dateUploaded method come from?


1 Answer

It's not a method. dateUploaded was one of the properties of a Gif object.

public class Gif {
    private String name;
    private LocalDate dateUploaded;
    private String username;
    private boolean favorite;
//%<------------------- partial code shown ----------

in the gif-details.html template, we have the following line:

<p th:text="'Uploaded on ' + ${gif.dateUploaded}">Uploaded on Oct 30 2015</p>

We are using SPring Expression Language (SPEL) to access the dateUploaded property (through the public getDateUploaded() getter) when we use th:text and $(gif.dateUploaded).