package net.pterodactylus.demoscenemusic.page;
-import java.util.Collection;
-
import net.pterodactylus.demoscenemusic.core.Core;
import net.pterodactylus.demoscenemusic.data.Artist;
-import net.pterodactylus.demoscenemusic.data.Track;
import net.pterodactylus.util.database.DatabaseException;
import net.pterodactylus.util.template.Template;
import net.pterodactylus.util.template.TemplateContext;
protected void processTemplate(TemplateContext templateContext, ServletRequest request) throws RedirectException {
try {
Artist artist = getCore().getDataManager().getArtistById(request.getServletRequest().getParameter("id"));
- if (artist != null) {
- Collection<Track> tracks = getCore().getDataManager().getTracksByArtist(artist.id());
- templateContext.set("artist", artist);
- templateContext.set("tracks", tracks);
- }
+ templateContext.set("artist", artist);
} catch (DatabaseException de1) {
/* TODO */
}
<h2>Tracks by <% artist.name|html></h2>
-<%foreach tracks track|sort>
+<%foreach artist.tracks track|sort>
<%first><ul><%/first>
<li><a href="track?id=<% track.id|html>"><% track.name|html></a></li>
<%last></ul><%/last>