4.1.Java Server Pages - COMP9321 Web Applications...

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: COMP9321 Web Applications Engineering Java Server Pages (JSP). Service Oriented Computing Group, CSE, UNSW Week 4 Notes prepared by Dr. Helen Hye-young Paik, CSE, UNSW. H. Paik (CSE, UNSW) COMP9321, 10s2 Week 4 1 / 1 Java ServerPages (JSP) A problem with servlets: HTML code is produced inside Java code eg., out.println(“ < H1 > Hello folks! < /H1 > ”); ie., low maintainability, mixture of presentation (eg., HTML) and business logic (eg., Java Code that extract data from tables) The HTML is inaccessible to non-Java developers – If you Web app is developed using Servlets, you will have to be an expert in HTML/CSS as well as in Java. H. Paik (CSE, UNSW) COMP9321, 10s2 Week 4 2 / 1 Java Servet Pages (JSP) JSP lets the programmer separate HTML coding from business logic (Java coding). The lifecycle of JSP is maintained by JSP container JSP really is just a servlet (it becomes one eventually!) JSP container converts a JSP to a servlet at runtime Servlet container and JSP container are normally combined into one (referred to as Web container) ................................. ................................. ................................. ................................. ................................. ................................. writes MyJSP.jsp MyJSP_jsp.java ................................. ................................. ................................. ................................. ................................. ................................. is translated to ................................. ................................. ................................. ................................. ................................. ................................. compiles to ............... ............... ............... ............... ............... ............... ............... ...... loaded and initlaised as MyJSP_jsp.class MyJSP_jsp Servlet H. Paik (CSE, UNSW) COMP9321, 10s2 Week 4 3 / 1 Java Servet Pages (JSP) 1. Parse JSP 2. Generate the Servlet code from JSP 3. Compile the Servlet code into a Servlet class 4. Run the Servlet Web Browser <FORM> <INPUT> parameters... </INPUT> </FORM> Web Server JSP Container JSP files DB request response request response H. Paik (CSE, UNSW) COMP9321, 10s2 Week 4 4 / 1 Java Servet Pages (JSP) Parsing, generating, compiling of JSP only happens on the first request. subsequent requests first request JSP translate execute Where do JSP pages go in .war structure? They are generally placed under the application root with other static content JSPs can be mapped to virtual URLs just like servlets Also some initial parameters can be set in web.xml <servlet> <servlet-name>ConfigDemo</servlet-name> <jsp-file>/configdemo.jsp</jsp-file> <init-param> <param-name>WebMaster</param-name> <param-value>Helen Paik</param-value> </init-param> </servlet> ’/’ in /configdemo.jsp means?...
View Full Document

{[ snackBarMessage ]}

Page1 / 77

4.1.Java Server Pages - COMP9321 Web Applications...

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