private Element getDescription(String task) { if (task != null) { if (task.equals("define")) return definer.getDescription(); if (task.equals("compare")) return comparer.getDescription(); if (task.equals("search")) return searcher.getDescription(); if (task.equals("wikify")) return wikifier.getDescription(); } Element description = doc.createElement("Description"); description.appendChild( createElement( "Details", "<p>This servlet provides a range of services for mining information from Wikipedia. Further details depend on what you want to do.</p>" + "<p>You can <a href=\"" + context.getInitParameter("service_name") + "?task=search&help\">search for pages</a>, <a href=\"" + context.getInitParameter("service_name") + "?task=compare&help\">measure how terms or articles related to each other</a>, <a href=\"" + context.getInitParameter("service_name") + "?task=define&help\">obtain short definitions from articles</a>, and <a href=\"" + context.getInitParameter("service_name") + "?task=wikify&help\">detect topics in web pages</a>.</p>")); Element paramTask = createElement( "Parameter", "Specifies what you want to do: can be <em>search</em>, <em>compare</em>, <em>define</em>, or <em>wikify</em>"); paramTask.setAttribute("name", "task"); description.appendChild(paramTask); Element paramId = doc.createElement("Parameter"); paramId.setAttribute("name", "help"); paramId.appendChild(doc.createTextNode("Specifies that you want help about the service.")); description.appendChild(paramId); return description; }