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 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,161 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 :).