95-702 Organizational Communications and Distributed Object Technologies Getting Started =============== Installation Lab ================ This lab is not to be turned in but needs to be completed as soon as possible. Contact your instructor or the TA if you are having difficulties. Part 1 Download and test. ========================= 0. Download and install Netbeans 6.5.1 from http://www.netbeans.org/downloads/index.html. Choose the largest bundle. 1. Publish a simple Java Server Page (JSP). Create a Netbeans project called SuperSimpleJSPProject. Select the category as Java Web and the Project as Web Application. Enter this document in the editor. Call it index.jsp. Test it in a browser. <% java.util.Date d = new java.util.Date(); %> Today is <%= d.toString() %> Part 2 Test a servlet and an index.jsp page. ============================================ 0. Provide the HTML in a JSP page. In a new project, enter this document as index.jsp: Introductions
Please enter name

1. Create a servlet and give it the name HandleForm. Give it the URL pattern /ProcessForm. HandleForm.java is invoked by Glassfish when an HTTP request arrives. // HandleForm.java // An introductory servlet import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class HandleForm extends HttpServlet{ public void doGet(HttpServletRequest req, HttpServletResponse response) throws ServletException, IOException { String personName = req.getParameter("personName"); response.setContentType("text/html"); PrintWriter out = response.getWriter(); String docType = "\n"; out.println(docType + "\n" + "Hi" + personName + "\n" + "\n" + "

Hi"+ personName + "

\n" + ""); } }