95-702 Organizational Communication and Distributed Object Technologies May 2008 Homework 1 Due: Friday, May 30 2008, Midnight ========== ======================================= In each part, documentation is required. For each of the three exercises below, submit a documented servlet, an index.jsp page, and a web.xml document. The documentation will include your name, a description of each piece of code and well-chosen variable names. 1. Write an index.jsp page that requests a user's name and provides a submit button. When the submit button is pressed a servlet is executed. The servlet sends 400 hello messages back to the browser. Each hello message appears on its own line and contains the user's name. For example, if the user enters Richard and hits the submit button, the output will look as follows: Hello Richard Hello Richard : : 2. A user can trick this servlet so that it behaves in an unintended manner. For example, a user might enter HTML code into the input field. If the input field contains the string "Amy" then Amy's name will be echoed back to the browser and displayed in bold. Write code in the servlet that prevents any use of anlgle brackets in the user input. Note: a complete answer for question 2 does not count for question 1. Question 1 must be completed separately. 3. Write a JSP page that allows the user to perform addition or multiplication on two, possible very large, integers. The JSP page will present three input fields to the user. The first two will be used to collect the two integers. The third will be used to collect the operation type. The only operations supported will be add and multiply. A submit button will be provided and when it is hit a servlet will be visited. The servlet will use the BigInteger class to perform the conversions from strings and the appropriate computation. The servlet will return the result to the browser marked up in HTML. You do not need to perform data validation in this assignment.