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 trialMike B
10,424 PointsWhy is there no "Preview" button in the code exercises?
I've noticed this on all of the Spring exercises so far? Maybe I'm more prone to errors than most but it would help a lot if I had something pointing where I made my syntax error
package com.teamtreehouse.contactmgr.controller;
import com.teamtreehouse.contactmgr.model.Contact;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.ui.ModelMap;
@Controller
public class ContactController {
@RequestMapping("/")
public String home() {
return "index";
}
@RequestMapping(value = "/contact")
public String contactDetails(ModelMap modelMap) {
Contact contact = new Contact(2, "Mike", "Brisson", "mikeb@mike.com");
modelMap.put("contact", contact);
return contact_detail;
}
}
package com.teamtreehouse.contactmgr.model;
public class Contact {
private int id;
private String firstName;
private String lastName;
private String email;
public Contact() {}
public Contact(int id, String firstName, String lastName, String email) {
this.id = id;
this.firstName = firstName;
this.lastName = lastName;
this.email = email;
}
public int getId() {
return id;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
public String getEmail() {
return email;
}
public void setId(int id) {
this.id = id;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public void setEmail(String email) {
this.email = email;
}
}
2 Answers
james white
78,399 PointsHi Mike,
I agree that a preview button is always helpful. (kinda makes it hard to debug what the answer engine wants without it, huh?)
But I've moved past the "insert-pojo-data-into-thymeleaf-template" challenge with the following code:
package com.teamtreehouse.contactmgr.controller;
import com.teamtreehouse.contactmgr.model.Contact;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.ui.ModelMap;
@Controller
public class ContactController {
@RequestMapping("/")
public String home() {
return "index";
}
@RequestMapping("/contact")
public String contact(ModelMap modelMap) {
Contact c = new Contact();
modelMap.put("contact",c);
return "contact_detail";
}
}
Right now I'm on the "Capture a URI parameter" challenge for of "Modeling, Storing, and Presenting Data":
..where I just tried to pasted your in your above code for
com/teamtreehouse/contactmgr/controller/ContactController.java
into that challenge and it does have a Preview button that says for "output.html":
./com/teamtreehouse/contactmgr/controller/ContactController.java:20: error: cannot find symbol
return contact_detail;
^
symbol: variable contact_detail
location: class ContactController
1 error
So what can I tell you -- some of the challenges may have preview buttons but others may not..
Did this course get the proper level of quality control?
You can read through this other forum thread where someone spotted a "bug" and I question how well this course got QA'ed:
https://teamtreehouse.com/community/spring-basics-intellij-not-recognizing-model-variables-in-html
That thread also has a link to my not-so-good review of this course.
My biggest complaint currrenty with a lot of the newer courses is that there is no .srt (video transcript and captioning) file,
so you have to go back and forth through the videos (tediously) to find where something was talked about and/or where a particular piece of code was explained.
With a video transcript present you can use the browser "Find" function to locate keywords.
Google search crawlers even index these video transcript text files so that in times past you could google for the old courses to find a key piece of information from the videos - now google is "blind" to these videos' content.
I think Treehouse's business model is undergoing revision (based on them eliminating the library subscriptions and cutting off CodeOregon people from getting career help) and this google video content hiding may be a strategy to increase subscriptions, but I really think it's low down.
Anyway, I just want to say to you Mike (as I said to Dmitry in that other thread) I feel your pain.
Mike B
10,424 PointsThanks, James. I'm still trying to figure out where you posted my code to generate the error.
As for the review, I did read it after stumbling upon it in one of the other questions. I really don't want to crap on treehouse...I completed the Java course and thought it was done exceptionally well...I was also impressed when they added the JavaFX module. Currently I'm going through the Android bit and I noticed that they swapped out Instructors but it still seems to be put together well.
This is the first course that I've noticed components missing like the preview button as well as the transcripts (I'll admit that I used google to help find solutions that pointed to some of transcripts here) but I have no idea who CodeOregon are so I can't really comment on that.
Either way, thank you for the help but I feel that I'm not going to make it through that Spring course until it gets fixed. I really struggled with the IntelliJ bug that won't allow the dynamic gif naming convention. I tried the fix that was posted and I couldn't work it out...it has taken the wind out of my sails.