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 trialRicardo Sala
16,212 PointsMapping challenge not passing
I do not why, but challenge one passes, then go to challenge two, completes it, and when I check the work it says challenge one no longer passes...
Could you please take a look? Can U see the differenc between your code and mine?
THANK YOU!
package com.teamtreehouse.contactmgr.controller;
import com.teamtreehouse.contactmgr.service.ContactService;
import com.teamtreehouse.contactmgr.model.Contact;
import org.springframework.stereotype.Controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class ContactController {
@Autowired
private ContactService contactService;
@RequestMapping(value = "/contacts", method = RequestMethod.POST)
public String add(Contact contact) {
contactService.add(contact)
return "redirect:/contacts/" + contact.getId();
}
}
2 Answers
Livia Galeazzi
Java Web Development Techdegree Graduate 21,083 PointsNot sure why it says the first challenge no longer passes. When I tried it with your code, I didn't have that message. The issue with your code is that you need to call:
contactService.save(contact);
Not:
contactService.add(contact);
Ricardo Sala
16,212 Pointsyep...that was it. I don't see why they call one "add" and the other "save"....
THANKS!