package int_2.servlets.assignments2; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import int_2.servlets.*; import int_2.tools.*; import int_2.beans.*; /** Please respect the copyright of this code. It is not allowed to copy this code and use at any circumstances. @author © Fredrik Andersson
This servlet uses code from my home made toolbox that you can find in the folder 8/tools and 8/beans. The toolbox is not ready yet, I have been working for it for a couple of years when I have time. The goal is to get a toolbox of classes so it will be easier to map tasks to use-case-diagram. This servlet collects a query string from a link. */ public class GetMethodLinks_2a extends GeneralServlet { public void start(HttpServletRequest request, HttpServletResponse response) throws IOException { Form form = FormManager.collectForm(request); String output = createPage("applications/int_2/int_2/templates/get_method_links.html", "get_method_links"); if(form == null) { output = TextManager.replaceInString(output, "XXXPARAMETERLISTXXX", "Push links above or type parameters in the url field."); } else { output = TextManager.replaceInString(output, "XXXPARAMETERLISTXXX", createParameterList(form)); } printString(output); flush(); } public String createParameterList(Form form) { StringBuffer stringBuffer = new StringBuffer(); String[] parameters = form.getAllKeys(); for(int i = 0; i < parameters.length; i++) { stringBuffer.append("
"); stringBuffer.append(parameters[i]); stringBuffer.append(" : "); stringBuffer.append((String)form.get(parameters[i])); } return stringBuffer.toString(); } }