<%-- Document : dgftriviaclip Created on : 18-Apr-2011, 18:06:26 Author : Peter Fothergill --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@page import="java.util.*" %> <%@page errorPage="dgferror.jsp" %> <%! private final ArrayList TRIVIA = new ArrayList(); private Random random = new Random(); public void jspInit() { TRIVIA.add(new TriviaItem("'Dayglo Pizza' is the only Dayglo Fishermen album not mixed and mastered in one of the band's dedicated studio facilities")); TRIVIA.add(new TriviaItem("For a very short period during 1991 the Dayglo Fishermen were known as 'Glo-Fish'")); TRIVIA.add(new TriviaItem("The band's official lineup has changed seven times, ranging from two to five members")); TRIVIA.add(new TriviaItem("Dayglo Fishermen initially formed to record just one song,'Fish'")); TRIVIA.add(new TriviaItem("The band's first concert was performed in a structure more than 600 years old")); TRIVIA.add(new TriviaItem("Peter is the only original member still with the band (Richard joined nine months after its formation)")); TRIVIA.add(new TriviaItem("Dayglo Fishermen have recorded in five dedicated production facilities: Artlite Studios, Opium Studios, Aqua-Lisa Studios, Cozmic Studios and Mammoth Studios")); TRIVIA.add(new TriviaItem("The name of the band's third album, 'Fresh Gin', was taken from an anagram of 'Dayglo Fishermen': 'O Fresh Gin M'Lady'")); TRIVIA.add(new TriviaItem("Dayglo Fishermen have never released an album in the months of February and December")); } public class TriviaItem { private String text; public TriviaItem(String text) { this.text = text; } /** * @return the text */ public String getText() { return text; } } %> Dayglo Fishermen Random Trivia Item <% int index = Math.abs(random.nextInt()); index %= TRIVIA.size(); TriviaItem triviaItem = null; try { triviaItem = TRIVIA.get(index); } catch (Exception ex) { triviaItem = TRIVIA.get(0); } %>
Random trivia:

<%= triviaItem.getText()%>