WTA11 JSP - Java Server Pages (JSP) Server Side Scripting 1...

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

View Full Document Right Arrow Icon
1 Java Server Pages (JSP) Server Side Scripting 1 2 JSP b Java Server Pages (JSP) technology enables you to mix regular, static HTML with dynamically generated content from servlets. b A JSP is a text-based document that describes how to process a request to create a response. The description intermixes template data with some dynamic actions and leverages the Java 2 Platform. b Eg : a HTML page that contains Java code.
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 JSP b JSP source code runs on the web server in the JSP Servlet Engine. The JSP Servlet engine dynamically generates the HTML and sends the HTML output to the client’s web browser. 3 Why use JSP? b JSP is easy to learn and allows developers to quickly produce web sites and applications in an open and standard way. JSP is based on Java, an object-oriented language. JSP offers a robust platform for web development. b Main reasons to use JSP: s Multi platform s Component reuse by using Javabeans and EJB. b HTML and graphics displayed on the web browser are classed as the presentation layer. The Java code (JSP) on the server is classed as the implementation. b By having a separation of presentation and implementation, web designers work only on the presentation and Java developers concentrate on implementing the application. 4
Background image of page 2
3 Advantages of Java b You can take one JSP file and move it to another platform, web server or JSP Servlet engine. This means you are never locked into one vendor or platform. 5 6 Java Server Pages (JSP) b Offers a layer of abstraction on top of Servlets. If the business process is the goal then servlet should be used. b Easier to code than a Servlet, but provides lesser finer control than that Servlets provide. Additional processing also required. b to produce and send back a Web page to the browser, in response to an HTTP request. b technologies, eg. JDBC for database access, JavaBeans for easier programming etc.
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 7 How JSP Works JSP Source Code Generated Servlet Source Code Compiled Servlet class Translation Compilation JSP file execution 8
Background image of page 4
5 Steps required for a JSP request: 9 The user goes to a web site made using JSP. The user goes to a JSP page (ending with .jsp). The web browser makes the request via the Internet. The JSP request gets sent to the Web server. The Web server recognises that the file required is special (.jsp),therefore passes the JSP file to the JSP Servlet Engine. If the JSP file has been called the first time, the JSP file is parsed, otherwise go to step 7. The next step is to generate a special Servlet from the JSP file. All the HTML required is converted to println statements. The Servlet source code is compiled into a class.
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 / 25

WTA11 JSP - Java Server Pages (JSP) Server Side Scripting 1...

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