jsp - part 3 - COP 4610L: Applications in the Enterprise...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
COP 4610L: JSPs – Part 3 Page 1 Mark Llewellyn © COP 4610L: Applications in the Enterprise Fall 2006 Introduction to JavaServer Pages (JSP) – Part 3 COP 4610L: Applications in the Enterprise Fall 2006 Introduction to JavaServer Pages (JSP) – Part 3 School of Electrical Engineering and Computer Science University of Central Florida Instructor : Mark Llewellyn markl@cs.ucf.edu ENG3 236, 823-2790 http://www.cs.ucf.edu/courses/cop4610/fall2006
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
COP 4610L: JSPs – Part 3 Page 2 Mark Llewellyn © A JSPs Conversion To A Servlet As shown in the diagram of the lifecycle of a JSP shown in part 2 (page 2), a JSP is converted into a servlet during execution. While the converted servlet looks very similar in nature to those we have already seen, there are some differences. Within Tomcat, the servlet version of the JSP is stored in the work directory (see part 2, page 12). The exact directory within the work directory depends in part on your Tomcat set-up and in part on your web-application structure. The next slide illustrates the location of the servlet files that were generated for the ComputeLoan.jsp and ComputeLoan2.jsp applications that appeared in part 2 of the notes on pages 7 and 13 respectively.
Background image of page 2
COP 4610L: JSPs – Part 3 Page 3 Mark Llewellyn © Servlet Versions of JSPs in Tomcat The servlet files corresponding to the JSPs from the loan web-application example Directory location of the servlet files
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
COP 4610L: JSPs – Part 3 Page 4 Mark Llewellyn © The Converted JSP - Servlet Version package org.apache.jsp.jsp; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; public final class ComputeLoan_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent { private static java.util.Vector _jspx_dependants; public java.util.List getDependants() { return _jspx_dependants; } public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { JspFactory _jspxFactory = null; PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; ComputeLoan Note that this package is reflected in the location shown in the previous slide.
Background image of page 4
COP 4610L: JSPs – Part 3 Page 5 Mark Llewellyn © Object page = this; JspWriter _jspx_out = null; PageContext _jspx_page_context = null; try { _jspxFactory = JspFactory.getDefaultFactory(); response.setContentType("text/html"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write("<!-- ComputeLoan.jsp -->\r\n"); out.write("<html>\r\n"); out.write("<head>\r\n"); out.write("<title>ComputeLoan</title>\r\n"); out.write("</head><body bgcolor=white background=images/background.jpg lang=EN-US link=blue vlink=blue\r\n"); out.write("style='tab-interval:.5in'>\r\n"); double loanAmount = Double.parseDouble( request.getParameter("loanAmount")); double annualInterestRate = Double.parseDouble(request.getParameter("annualInterestRate"));
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 46

jsp - part 3 - COP 4610L: Applications in the Enterprise...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online