<%@ page import="uk.org.mafoo.wordsearch.*" %> <%@ page import="java.util.*" %> <%@ page import="org.apache.commons.lang.StringUtils" %> <%@ page import="org.apache.commons.lang.StringEscapeUtils" %> <%@ page errorPage="error.jsp" %> <% int height = Integer.parseInt(request.getParameter("height")); int width = Integer.parseInt(request.getParameter("width")); boolean simple = request.getParameter("simple") != null; String name = StringEscapeUtils.escapeHtml(request.getParameter("name")); if (request.getParameter("words").length() > 2048) { throw new Exception("Input too large"); } if (height > 100 || width > 100) { throw new Exception("Dimentions too large"); } List words = new ArrayList(); for ( String line : request.getParameter("words").split("\r\n")) { words.add(line.trim()); } Collections.sort(words); char[][] grid = GridFactory.makeGrid(words, height, width, simple); String csv = ""; %>

<%= name %>

Download CSV

Grid

<% for(char[] row : grid) { %> <% for(char c : row) { csv += "" + c + ','; %> <% } %> <% csv += "\\n"; } %>
<%= c %>

Words

    <% for (String word : words) { %>
  • <%= word.trim() %>
  • <% } %>