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 with Hibernate File Uploads and Entity Updates in Spring + Hibernate Updating GIFs

Anish Palan
Anish Palan
3,157 Points

Significance of the parameter in {} in @RequestMapping (value= "/gifs/{gifId}/edit")

While running my application the {gifId} was misspelled as {dgifI} so I wasnt getting the correct edit page which is supposed to be shown on clicking edit link. How do we decide what to put in {} ?

1 Answer

Alexander Nikiforov
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 Points

It does not matter what to put in @RequestMapping(value = "/gifs/{gifid}") as long as later in @PathVariable you re-type correctly what was in @RequestMapping, e.g. this is right :

@RequestMapping(value = "/gifs/{someId}")
public String someMethod(@PathVariable("someId") int actualSomeIdToBeUsed)

As long as someId in the example in @PathVariable and @RequestMapping are same, it does not matter how you call it.

Boban Talevski
Boban Talevski
24,793 Points

And I suppose Chris had intentionally left it misspelled there (I know I would now that I saw it :P), which was an interesting thing to catch while implementing the gif update and upload methods. Guess the point was, don't assume any of the present code is perfectly working and look for weird typos which won't be caught at compile time. Now I know better for sure :).