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 trialKyle Budd
7,821 Points404 Error when uploading a new GIF
I am receiving a 404 Error page anytime I try to add a new GIF. The image is saving to the h2 Database, but the gif/details.html page does not render.
I am also having issues accessing the Single Category page. Every time I try to access this page I am receiving a 500 Error and an "Exception evaluating SpringEL expression: "category.colorCode" (category/details:9)". I have gone through my code multiple times and still unable to resolve after comparing to the github repo for this course.
Instead of posting all of my code here, it can be found on my github repository:
2 Answers
Fahad Mutair
10,359 Points // Upload a new GIF
@RequestMapping(value = "/gifs", method = RequestMethod.POST)
public String addGif(Gif gif, @RequestParam MultipartFile file, RedirectAttributes redirectAttributes) {
// TODO: Upload new GIF if data is valid
gifService.save(gif, file);
// Add a flash message for success
redirectAttributes.addFlashAttribute("flash", new FlashMessage("GIF successfully added", Status.SUCCESS));
// TODO: Redirect browser to new GIF's detail view
return String.format("redirect:/gifs/%s", gif.getId());
}
you have error at return line redirect:/gif it should be gifs
Kyle Budd
7,821 PointsThank you Fahad Mutair!