Created
October 3, 2009 13:07
-
-
Save dlinsin/200631 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@At("/guestbook") | |
public class Guestbook { | |
private List<Entry> entries; | |
private Entry newEntry = new Entry(); | |
@Inject | |
private EntryDao entryDao; | |
public List<Entry> getEntries() { | |
return entries; | |
} | |
@Get | |
public void load() { | |
entries = entryDao.readAll(); | |
} | |
@Post | |
public String save() { | |
newEntry.setDate(new Date()); | |
Integer id = entryDao.save(newEntry); | |
return String.format("/sample/guestbook/%1$s", id); | |
} | |
public Entry getNewEntry() { | |
return newEntry; | |
} | |
public void setNewEntry(Entry argNewEntry) { | |
newEntry = argNewEntry; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment