<%@ page import="uk.org.mafoo.wordsearch.*" %> <%@ page import="java.util.*" %> <%@ page errorPage="error.jsp" %> <% int height = Integer.parseInt(request.getParameter("height")); int width = Integer.parseInt(request.getParameter("width")); if (request.getParameter("words").length() > 2048) { throw new Exception("Input too large"); } List words = new ArrayList(); for ( String line : request.getParameter("words").split("\r\n")) { words.add(line.trim()); } char[][] grid = GridFactory.makeGrid(words, height, width); %>

Wordsearch builder

Words

Grid

<% for(char[] row : grid) { %> <% for(char c : row) { %> <% } %> <% } %>
<%= c %>