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.


404 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
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

Thank you Fahad Mutair!