2. JSP Basics SKILLBUILDERS. Java Training: JSP Basics SkillBuilders, Inc. V3.1

Size: px
Start display at page:

Download "2. JSP Basics SKILLBUILDERS. Java Training: JSP Basics SkillBuilders, Inc. V3.1"

Transcription

1 : JSP Basics JSP Basics JSP Translation Predefined Variables Expressions Scriptlets Declarations Other JSP Issues Page Context Installing a JSP JSP Errors SKILLBUILDERS

2 : JSP Basics 2.2 JSP Basics 2.2 Server translates a JSP into a servlet: An HTTP servlet Key method is service( ) Static content translates to statements of this form: out.println( out.println( String String / char char constant constant ) For example: The snoop JSP from Java Web Server It displays request information See notes for: Original JSP Resulting servlet

3 : JSP Basics 2.3 The Original JSP <html> <body bgcolor="white"> <H1 align="center">javaserver Pages 1.0</H1> <H2 align="center">snoop Example</H2> <P> </P><P> </P> <h1> Request Information </h1> <font size="4"> JSP Request Method: <%= request.getmethod() %> <br> Request URI: <%= request.getrequesturi() %> <br> Request Protocol: <%= request.getprotocol() %> <br> Servlet path: <%= request.getservletpath() %> <br> Path info: <%= request.getpathinfo() %> <br> Path translated: <%= request.getpathtranslated() %> <br> Query string: <%= request.getquerystring() %> <br> Content length: <%= request.getcontentlength() %> <br> Content type: <%= request.getcontenttype() %> <br> Server name: <%= request.getservername() %> <br> Server port: <%= request.getserverport() %> <br> Remote user: <%= request.getremoteuser() %> <br> Remote address: <%= request.getremoteaddr() %> <br> Remote host: <%= request.getremotehost() %> <br> Authorization scheme: <%= request.getauthtype() %> <hr> The browser you are using is <%= request.getheader("user-agent") %> <hr> </font> </body> </html>

4 : JSP Basics 2.4 The Generated Servlet public class _snoop extends HttpJspBase { static char[][] _jspx_html_data = null; final String DATAFILE = "E:\\java\\JavaWebServer2.0\\tmpdir\\default" + "\\pagecompile\\jsp\\_examples\\_jsp\\_samples\\_snoop" + "\\pagecompile.jsp._examples._jsp._samples._snoopsnoop.dat" public _snoop( ) { private static boolean _jspx_inited = false; public final void _jspx_init() throws JspException { ObjectInputStream oin = null; int numstrings = 0; try { FileInputStream fin = new FileInputStream(DATAFILE); oin = new ObjectInputStream(fin); _jspx_html_data = (char[][]) oin.readobject(); catch (Exception ex) { throw new JspException("Unable to open data file"); finally { if (oin!= null) try { oin.close(); catch (IOException ignore) { public void _jspservice(httpservletrequest request, HttpServletResponse response) throws IOException, ServletException { boolean _jspx_cleared_due_to_forward = false; JspFactory _jspxfactory = null; PageContext pagecontext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; String _value = null; // Continued...

5 : JSP Basics 2.5 try { if (_jspx_inited == false) { _jspx_init(); _jspx_inited = true; _jspxfactory = JspFactory.getDefaultFactory(); response.setcontenttype("text/html"); pagecontext = _jspxfactory.getpagecontext(this, request, response, "", true, 8192, true); // Initialize various variables... out = pagecontext.getout(); // Print output out.print(_jspx_html_data[0]); out.print( request.getmethod() ); out.print(_jspx_html_data[1]); out.print( request.getrequesturi() ); out.print(_jspx_html_data[2]); out.print( request.getprotocol() ); out.print(_jspx_html_data[3]); out.print( request.getservletpath() ); out.print(_jspx_html_data[4]); out.print( request.getpathinfo() ); out.print(_jspx_html_data[5]); out.print( request.getpathtranslated() ); out.print(_jspx_html_data[6]); out.print( request.getquerystring() ); out.print(_jspx_html_data[7]); out.print( request.getcontentlength() ); out.print(_jspx_html_data[8]); out.print( request.getcontenttype() ); out.print(_jspx_html_data[9]); out.print( request.getservername() ); out.print(_jspx_html_data[10]); out.print( request.getserverport() ); out.print(_jspx_html_data[11]); out.print( request.getremoteuser() ); out.print(_jspx_html_data[12]); out.print( request.getremoteaddr() ); out.print(_jspx_html_data[13]); out.print( request.getremotehost() ); out.print(_jspx_html_data[14]); out.print( request.getauthtype() ); out.print(_jspx_html_data[15]); out.print( request.getheader("user-agent") ); out.print(_jspx_html_data[16]); // Continued...

6 : JSP Basics 2.6 catch (Throwable t) { if (out.getbuffersize()!= 0) out.clear(); throw new JspException("Unknown exception: ", t); finally { if (!_jspx_cleared_due_to_forward) out.flush(); _jspxfactory.releasepagecontext(pagecontext);

7 : JSP Basics Predefined Variables JSP engine recognizes some predefined variables: Request response in out session config The HttpServletRequest object The HttpServletResponse object The BufferedReader returned by ServletRequest#getReader( ) The PrintWriter returned by ServletResponse#getWriter( ) The HttpSession for this page The ServletConfig object for this page Returned by getservletconfig( ) Application The ServletContext for this page. Returned by getservletconfig().getservletcontext() See examples in notes... In your JSP syntax you can use a number of predefined variables (shown above) representing basic servlet objects. These variables simplify your JSP markup considerably. For example, the snoop JSP made extensive use of the request variable representing the HttpServletRequest object passed to the service( ) method: JSP Request Method: <%= request.getmethod() %> Request URI: <%= request.getrequesturi() %> Request Protocol: <%= request.getprotocol() %>

8 : JSP Basics 2.8 JSP Expressions 2.8 JSP Expressions: Special markup that evaluates to some value Value is converted to a String, included in output Two syntax versions: JSP syntax: XML syntax: <%= <%= expression %> %> <jsp:expr> expression </jsp:expr> expression is any valid Java expression Server name: name: <%= <%= request.getservername() %> %> User User ID: ID: <%= <%= request.getparameter("uid") %> %> Password: <%= <%= request.getparameter("pwd") %> %> Today Today is: is: <jsp:expr> new new java.util.date() </jsp:expr>

9 : JSP Basics 2.9 JSP Scriptlets: Scriptlets Special markup containing snippets of Java code JSP can have multiple scriptlets Server assembles them into single service( ) method Intervening HTML becomes out.println( ) statements Two syntax versions: JSP syntax: <% <% Java Javacode %> %> XML syntax: <jsp:scriptlet> Java Java code code </jsp:scriptlet> Must contain valid Java code when translated Can declare local variables 2.9

10 : JSP Basics 2.10 A Scriptlet Example A scriptlet example in 3 versions: A simple Greeting JSP Version 1: Uses a single scriptlet Contains a complete Java if / else structure Version 2: Uses scriptlets mixed with expressions and static text Each scriptlet is a code fragmen. Together they make a complete structure Version 3: Same as 2, but declares a local variable See notes

11 : JSP Basics 2.11 Greeting JSP, Version 1 This version of the Greeting JSP uses a single scriptlet: <HTML> <HEAD><TITLE>Greeting</TITLE></HEAD> <BODY> <% if(request.getparameter("name") == null) { out.println("you must supply a name!"); else { out.println("greetings, " + request.getparameter("name")); %> </BODY> </HTML> Greeting JSP, Version 2 This version of the Greeting JSP uses several scriptlets and an expression: <BODY> <% if(request.getparameter("name") == null) { %> You must supply a name! <% else { %> Greetings, <%= request.getparameter("name") %> <% %> </BODY> Greeting JSP, Version 3 This version is the same as 2 but declares a local string variable for the name to avoid calling getparameter( ) more than once: <BODY> <% String strname = request.getparameter("name"); if(strname == null) { %> You must supply a name! <% else { %> Greetings, <%= strname %> <% %> </BODY>

12 : JSP Basics 2.12 JSP Declarations: Declarations Special markup containing class level code Can declare instance / static variables Can declare additional methods for servlet Called from expressions & scriptlets Two syntax versions: JSP syntax: XML syntax: Order: <%! <%! Java Java code code %> %> <jsp:declaration> Java Java code code </jsp:declaration> Declarations can go after expressions & scriptlets 2.12

13 : JSP Basics 2.13 A Declaration Example A hit count JSP in 3 versions: Each uses an instance var for count All produce the same output Version 1: A simple expression increments and uses the instance variable Version 2: A separate declaration defines a private method for hit display Expression calls the method Version 3: Declarations at end of JSP See code in notes

14 : JSP Basics 2.14 Hit Count JSP, Version 1: Here s the JSP that produced the picture on the slide. It has a simple declaration for the instance variable that retains the hit count. The variable is then used in a JSP expression: <HTML> <HEAD><TITLE>Hit Count JSP</TITLE></HEAD> <BODY> <%! private int _ihitcount; %> <CENTER> <H1>Hit Count JSP</H1> <P>This JSP tracks the number of hits to this page using a declaration to declare an instance variable. <P>Hits as of <%= new java.util.date() %>: <%= ++_ihitcount %> </CENTER> </BODY> </HTML> Hit Count JSP, Version 2: Here is the same JSP declaring and calling a private function to compose the display message. The output is identical: <HTML> <HEAD><TITLE>Hit Count JSP</TITLE></HEAD> <BODY> <%! private int _ihitcount; %> <%! private String gethitcountmessage() { return "Hits as of " + new java.util.date() + ": " + ++_ihitcount; %> <CENTER> <H1>Hit Count JSP</H1> <P>This JSP tracks the number of hits to this page using a declaration to declare an instance variable. <P><%= gethitcountmessage() %> </CENTER> </BODY> </HTML>

15 : JSP Basics 2.15 Hit Count JSP, Version 3: Here is a variation on version 2 that has the declarations at the end of the JSP. The result is the same: <HTML> <HEAD><TITLE>Hit Count JSP</TITLE></HEAD> <BODY> <CENTER> <H1>Hit Count JSP</H1> <P>This JSP tracks the number of hits to this page using a declaration to declare an instance variable. <P><%= gethitcountmessage() %> </CENTER> </BODY> </HTML> <!-- Notice that these JSP declarations come after the JSP expression above that uses the function. That doesn't matter; the resulting servlet behaves the same way. --> <%! private int _ihitcount; %> <%! private String gethitcountmessage() { return "Hits as of " + new java.util.date() + ": " + ++_ihitcount; %>

16 : JSP Basics 2.16 JSP Translation: Summary 2.16 To summarize how JSPs are translated into servlets: Static text: Fed to out.print( ) in service( ) method JSP expressions: Fed to out.print( ) in service( ) method Scriptlets: Code included in service( ) method Declarations: Class-level code (variables & methods) See example in notes...

17 : JSP Basics 2.17 Another version of snoop.jsp in which a scriptlet declares local arrays and a declaration creates a separate private method. <%! // Private method for composing a label and value private String composeitem(string label, String value) { return label + ": " + value + "<br>"; %> <html> <body bgcolor="white"> <H1 align="center">javaserver Pages 1.1</H1> <H2 align="center">snoop Example</H2> <P> </P> <P> </P> <h1> Request Information </h1> <font size="4"> <% String[] strlabels = { "JSP Request Method", "Request URI",... ; String[] strvalues = { request.getmethod(), request.getrequesturi(),... ; for(int i = 0; i < strlabels.length; i++) %> <%= composeitem(strlabels[i], strvalues[i] %> </font> </body> </html>

18 : JSP Basics 2.18 And the resulting servlet: public class _snoop extends HttpJspBase { static char[][] _jspx_html_data = null; final String DATAFILE =...; public _snoop( ) { private static boolean _jspx_inited = false; public final void _jspx_init() throws JspException { //... // Private method for composing a label and value private String composeitem(string label, String value) { return label + ": " + value + "<br>"; public void _jspservice(httpservletrequest request, HttpServletResponse response) throws IOException, ServletException { // Declare variables as before... try { // Initialize variables as before... String[] strlabels = { "JSP Request Method", "Request URI",... ; String[] strvalues = { request.getmethod(), request.getrequesturi(),... ; From From declaration declaration From From scriptlet scriptlet out.print(_jspx_html_data[0]); for(int i = 0; i < strlabels.length; i++) out.print(composeitem(strlabels[i], strvalues[i]); catch (Throwable t) { /*... */ finally { /*... */

19 : JSP Basics 2.19 Other JSP Issues Commenting out part of JSP: HTML comments do not suppress JSP Contents still part of servlet & output Browser ignores To comment out JSP logic: Use a scriptlet with Java comments: Contents not part of servlet & output Escaping special characters: Use for literals in special places: Static text Scriptlets Attributes 2.19 <!-- <!-- Lines Lines to to suppress --> --> <% <% /* /* Lines Lines to to suppress */ */ %> %> Literal Literal Escaped Escaped <% <% <\% <\% %> %> %\> %\> ' \' \' " \" \" \ \\ \\

20 : JSP Basics Page Context Page context An object giving access to attributes/properties for this page An instance of javax.servlet.jsp.pagecontext All JSPs participating in a page share a PageContext How to get the current PageContext? Available through pre-defined JSP variable page A PageContext can hold data: Use familiar methods: setattribute( ), getattribute( ), etc.

21 : JSP Basics Installing & Using JSPs To install a JSP: Simply copy file to designated server directory Or package in J2EE WAR file Often, no need to inform server of JSP s presence Invoking the JSP: Invoke via URL of JSP file First invocation is slow; server is writing servlet Developer can invoke it to trigger servlet creation Product-specific details follow...

22 : JSP Basics 2.22 If JSP Has Errors 2.22 If JSP has syntax errors: JSP engine cannot create servlet Invoking JSP returns HTML error page Resulting page should say where error occurred For example: Here is WebLogic s page Syntax error in Hit Count JSP. See notes...

23 : JSP Basics 2.23 Here is a JSP with a syntactical error that triggered (in WebLogic) the translation error page shown on the slide: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <HTML> <HEAD><TITLE>Hit Count JSP</TITLE></HEAD> <BODY> <CENTER> <%! private int _ihitcount; %> <%! private String gethitcountmessage() { return "Hits as of " + new java.util.date() + ": " + ++_ihitcount; Error: Error: No No closing closing %> %> <H1>Hit Count JSP</H1> <P>This JSP tracks the number of hits to this page using a declaration to declare an instance variable. <P><%= gethitcountmessage() %> </CENTER> </BODY> </HTML>

24 : JSP Basics Where We've Been JSP recognizes certain predefined variables request, response, in, out, session, etc. Expressions: Let you embed values in output Scriptlets: Contain code snippets for service( ) method Declarations: Contain code for class level

25 : JSP Basics 2.25 Using Basic JSP Constructs Workshop 2.25 Your Objective In this workshop you will create a JSP using expressions and scriptlets. The lab consists of two files: 1. register.html presents a customer registration form. The user fills in fields for name, address, phone and credit card number, then clicks the Submit button. This button triggers the JSP. 2. welcome.jsp displays a welcome screen containing the information passed by register.html as request parameters. A. Examine the Files 1. The two files have been started for you. Locate them in the labs\initial\basic directory under your course directory. Copy these files, together with web.xml, to the labs directory 2. Open register.html and examine it. You will see that it creates several INPUT boxes with specific names. When the Submit button is clicked, the contents of these boxes are passed as request parameters with the respective names. Continues

26 : JSP Basics 2.26 B. Complete register.html 1. In register.html, find the ACTION attribute of the FORM tag. For the value, fill in a relative URL that points to welcome.jsp. The URL must start from the root server directory where the file is located, or the name of the war file. For example, if welcome.jsp is in the root directory of a war file named Labs.war, use the URL /labs/welcome.jsp (use forward slashes). 2. Save your work. C. Use Expressions in the Welcome Page 1. Use JSP expressions to display the following request parameters in welcome.jsp (look for comments in the file indicating where to put the expressions): a. In the Welcome heading, the customer s name. b. In the table, the customer s name, address, city, state, zip and credit card number. 2. Save your work. 3. Deploy your web application by running ant - make sure you are in the \jspcourse\labs directory - type: ant and press Enter 4. Test your work by invoking register.html through the Web server. For example, if you are running Java Web Server locally, the URL might look something like this: Fill in values and click Submit. Continues

27 : JSP Basics 2.27 D. Add Conditional Display Use JSP scriptlets to add a conditional display to the welcome page: If the user enters a credit card number, display it in the table. If not, display the paragraph about paying cash. Hints: 1. The request parameter will always be a valid string. If the user doesn t enter a value, the parameter value will be an empty (zero-length) string. 2. You will need three separate scriptlets for your if / else block. Note: In your code you will have to refer to the credit card parameter value at least twice. Rather than call getparameter( ) more than once, declare a local variable to capture the value, then use the variable.

Pure server-side Web Applications with Java, JSP. Application Servers: the Essential Tool of Server-Side Programming. Install and Check Tomcat

Pure server-side Web Applications with Java, JSP. Application Servers: the Essential Tool of Server-Side Programming. Install and Check Tomcat Pure server-side Web Applications with Java, JSP Discussion of networklevel http requests and responses Using the Java programming language (Java servlets and JSPs) Key lesson: The role of application

More information

2.8. Session management

2.8. Session management 2.8. Session management Juan M. Gimeno, Josep M. Ribó January, 2008 Session management. Contents Motivation Hidden fields URL rewriting Cookies Session management with the Servlet/JSP API Examples Scopes

More information

Class Focus: Web Applications that provide Dynamic Content

Class Focus: Web Applications that provide Dynamic Content Class Focus: Web Applications that provide Dynamic Content We will learn how to build server-side applications that interact with their users and provide dynamic content Using the Java programming language

More information

JSP Java Server Pages

JSP Java Server Pages JSP - Java Server Pages JSP Java Server Pages JSP - Java Server Pages Characteristics: A way to create dynamic web pages, Server side processing, Based on Java Technology, Large library base Platform independence

More information

Web Programming: Announcements. Sara Sprenkle August 3, 2006. August 3, 2006. Assignment 6 due today Project 2 due next Wednesday Review XML

Web Programming: Announcements. Sara Sprenkle August 3, 2006. August 3, 2006. Assignment 6 due today Project 2 due next Wednesday Review XML Web Programming: Java Servlets and JSPs Sara Sprenkle Announcements Assignment 6 due today Project 2 due next Wednesday Review XML Sara Sprenkle - CISC370 2 1 Web Programming Client Network Server Web

More information

Services. Custom Tag Libraries. Today. Web Development. Role-Based. Development. Code Reuse. Tag Libraries Custom Tags. Tag Lifecycle.

Services. Custom Tag Libraries. Today. Web Development. Role-Based. Development. Code Reuse. Tag Libraries Custom Tags. Tag Lifecycle. JSP, and JSP, and 1 JSP, and Custom Lecture #6 2008 2 JSP, and JSP, and interfaces viewed as user interfaces methodologies derived from software development done in roles and teams role assignments based

More information

Introduction to J2EE Web Technologies

Introduction to J2EE Web Technologies Introduction to J2EE Web Technologies Kyle Brown Senior Technical Staff Member IBM WebSphere Services RTP, NC brownkyl@us.ibm.com Overview What is J2EE? What are Servlets? What are JSP's? How do you use

More information

Managing Data on the World Wide-Web

Managing Data on the World Wide-Web Managing Data on the World Wide-Web Sessions, Listeners, Filters, Shopping Cart Elad Kravi 1 Web Applications In the Java EE platform, web components provide the dynamic extension capabilities for a web

More information

Creating Java EE Applications and Servlets with IntelliJ IDEA

Creating Java EE Applications and Servlets with IntelliJ IDEA Creating Java EE Applications and Servlets with IntelliJ IDEA In this tutorial you will: 1. Create IntelliJ IDEA project for Java EE application 2. Create Servlet 3. Deploy the application to JBoss server

More information

CSc31800: Internet Programming, CS-CCNY, Spring 2004 Jinzhong Niu May 9, 2004. Java Servlets

CSc31800: Internet Programming, CS-CCNY, Spring 2004 Jinzhong Niu May 9, 2004. Java Servlets CSc31800: Internet Programming, CS-CCNY, Spring 2004 Jinzhong Niu May 9, 2004 Java Servlets I have presented a Java servlet example before to give you a sense of what a servlet looks like. From the example,

More information

ACM Crossroads Student Magazine The ACM's First Electronic Publication

ACM Crossroads Student Magazine The ACM's First Electronic Publication Page 1 of 8 ACM Crossroads Student Magazine The ACM's First Electronic Publication Crossroads Home Join the ACM! Search Crossroads crossroads@acm.org ACM / Crossroads / Columns / Connector / An Introduction

More information

www.virtualians.pk CS506 Web Design and Development Solved Online Quiz No. 01 www.virtualians.pk

www.virtualians.pk CS506 Web Design and Development Solved Online Quiz No. 01 www.virtualians.pk CS506 Web Design and Development Solved Online Quiz No. 01 Which of the following is a general purpose container? JFrame Dialog JPanel JApplet Which of the following package needs to be import while handling

More information

Java Server Pages and Java Beans

Java Server Pages and Java Beans Java Server Pages and Java Beans Java server pages (JSP) and Java beans work together to create a web application. Java server pages are html pages that also contain regular Java code, which is included

More information

Server-Side Web Development JSP. Today. Web Servers. Static HTML Directives. Actions Comments Tag Libraries Implicit Objects. Apache.

Server-Side Web Development JSP. Today. Web Servers. Static HTML Directives. Actions Comments Tag Libraries Implicit Objects. Apache. 1 Pages () Lecture #4 2007 Pages () 2 Pages () 3 Pages () Serves resources via HTTP Can be anything that serves data via HTTP Usually a dedicated machine running web server software Can contain modules

More information

Ch-03 Web Applications

Ch-03 Web Applications Ch-03 Web Applications 1. What is ServletContext? a. ServletContext is an interface that defines a set of methods that helps us to communicate with the servlet container. There is one context per "web

More information

PA165 - Lab session - Web Presentation Layer

PA165 - Lab session - Web Presentation Layer PA165 - Lab session - Web Presentation Layer Author: Martin Kuba Goal Experiment with basic building blocks of Java server side web technology servlets, filters, context listeners,

More information

Web Container Components Servlet JSP Tag Libraries

Web Container Components Servlet JSP Tag Libraries Web Application Development, Best Practices by Jeff Zhuk, JavaSchool.com ITS, Inc. dean@javaschool.com Web Container Components Servlet JSP Tag Libraries Servlet Standard Java class to handle an HTTP request

More information

2. Follow the installation directions and install the server on ccc

2. Follow the installation directions and install the server on ccc Installing a Web Server 1. Install a sample web server, which supports Servlets/JSPs. A light weight web server is Apache Tomcat server. You can get the server from http://tomcat.apache.org/ 2. Follow

More information

An introduction to web programming with Java

An introduction to web programming with Java Chapter 1 An introduction to web programming with Java Objectives Knowledge Objectives (continued) The first page of a shopping cart application The second page of a shopping cart application Components

More information

Outline. CS 112 Introduction to Programming. Recap: HTML/CSS/Javascript. Admin. Outline

Outline. CS 112 Introduction to Programming. Recap: HTML/CSS/Javascript. Admin. Outline Outline CS 112 Introduction to Programming Web Programming: Backend (server side) Programming with Servlet, JSP q Admin and recap q Server-side web programming overview q Servlet programming q Java servlet

More information

If you wanted multiple screens, there was no way for data to be accumulated or stored

If you wanted multiple screens, there was no way for data to be accumulated or stored Handling State in Web Applications Jeff Offutt http://www.cs.gmu.edu/~offutt/ SWE 642 Software Engineering for the World Wide Web sources: Professional Java Server Programming, Patzer, Wrox Web Technologies:

More information

Controlling Web Application Behavior

Controlling Web Application Behavior 2006 Marty Hall Controlling Web Application Behavior The Deployment Descriptor: web.xml JSP, Servlet, Struts, JSF, AJAX, & Java 5 Training: http://courses.coreservlets.com J2EE Books from Sun Press: http://www.coreservlets.com

More information

WIRIS quizzes web services Getting started with PHP and Java

WIRIS quizzes web services Getting started with PHP and Java WIRIS quizzes web services Getting started with PHP and Java Document Release: 1.3 2011 march, Maths for More www.wiris.com Summary This document provides client examples for PHP and Java. Contents WIRIS

More information

Session Tracking Customized Java EE Training: http://courses.coreservlets.com/

Session Tracking Customized Java EE Training: http://courses.coreservlets.com/ 2012 Marty Hall Session Tracking Originals of Slides and Source Code for Examples: http://courses.coreservlets.com/course-materials/csajsp2.html 2 Customized Java EE Training: http://courses.coreservlets.com/

More information

Handling the Client Request: Form Data

Handling the Client Request: Form Data 2012 Marty Hall Handling the Client Request: Form Data Originals of Slides and Source Code for Examples: http://courses.coreservlets.com/course-materials/csajsp2.html 3 Customized Java EE Training: http://courses.coreservlets.com/

More information

Getting Started with Web Applications

Getting Started with Web Applications 3 Getting Started with Web Applications A web application is a dynamic extension of a web or application server. There are two types of web applications: Presentation-oriented: A presentation-oriented

More information

Usability. Usability

Usability. Usability Objectives Review Usability Web Application Characteristics Review Servlets Deployment Sessions, Cookies Usability Trunk Test Harder than you probably thought Your answers didn t always agree Important

More information

Configure a SOAScheduler for a composite in SOA Suite 11g. By Robert Baumgartner, Senior Solution Architect ORACLE

Configure a SOAScheduler for a composite in SOA Suite 11g. By Robert Baumgartner, Senior Solution Architect ORACLE Configure a SOAScheduler for a composite in SOA Suite 11g By Robert Baumgartner, Senior Solution Architect ORACLE November 2010 Scheduler for the Oracle SOA Suite 11g: SOAScheduler Page 1 Prerequisite

More information

The presentation explains how to create and access the web services using the user interface. WebServices.ppt. Page 1 of 14

The presentation explains how to create and access the web services using the user interface. WebServices.ppt. Page 1 of 14 The presentation explains how to create and access the web services using the user interface. Page 1 of 14 The aim of this presentation is to familiarize you with the processes of creating and accessing

More information

Web Applications. For live Java training, please see training courses at

Web Applications. For live Java training, please see training courses at 2009 Marty Hall Using and Deploying Web Applications Originals of Slides and Source Code for Examples: http://courses.coreservlets.com/course-materials/msajsp.html Customized Java EE Training: http://courses.coreservlets.com/

More information

11.1 Web Server Operation

11.1 Web Server Operation 11.1 Web Server Operation - Client-server systems - When two computers are connected, either could be the client - The client initiates the communication, which the server accepts - Generally, clients

More information

Agenda. Summary of Previous Session. Application Servers G22.3033-011. Session 3 - Main Theme Page-Based Application Servers (Part II)

Agenda. Summary of Previous Session. Application Servers G22.3033-011. Session 3 - Main Theme Page-Based Application Servers (Part II) Application Servers G22.3033-011 Session 3 - Main Theme Page-Based Application Servers (Part II) Dr. Jean-Claude Franchitti New York University Computer Science Department Courant Institute of Mathematical

More information

Java Server Pages (JSP)

Java Server Pages (JSP) Java Server Pages (JSP) What is JSP JSP simply puts Java inside HTML pages. You can take any existing HTML page and change its extension to ".jsp" instead of ".html". Scripting elements are used to provide

More information

15-415 Database Applications Recitation 10. Project 3: CMUQFlix CMUQ s Movies Recommendation System

15-415 Database Applications Recitation 10. Project 3: CMUQFlix CMUQ s Movies Recommendation System 15-415 Database Applications Recitation 10 Project 3: CMUQFlix CMUQ s Movies Recommendation System Project Objective 1. Set up a front-end website with PostgreSQL back-end 2. Allow users to login, like

More information

Servlet and JSP Filters

Servlet and JSP Filters 2009 Marty Hall Servlet and JSP Filters Originals of Slides and Source Code for Examples: http://courses.coreservlets.com/course-materials/msajsp.html Customized Java EE Training: http://courses.coreservlets.com/

More information

In this chapter, we lay the foundation for all our further discussions. We start

In this chapter, we lay the foundation for all our further discussions. We start 01 Struts.qxd 7/30/02 10:23 PM Page 1 CHAPTER 1 Introducing the Jakarta Struts Project and Its Supporting Components In this chapter, we lay the foundation for all our further discussions. We start by

More information

Servlets. Based on Notes by Dave Hollinger & Ethan Cerami Also, the Online Java Tutorial by Sun

Servlets. Based on Notes by Dave Hollinger & Ethan Cerami Also, the Online Java Tutorial by Sun Servlets Based on Notes by Dave Hollinger & Ethan Cerami Also, the Online Java Tutorial by Sun 1 What is a Servlet? A Servlet is a Java program that extends the capabilities of servers. Inherently multi-threaded.

More information

Building a Multi-Threaded Web Server

Building a Multi-Threaded Web Server Building a Multi-Threaded Web Server In this lab we will develop a Web server in two steps. In the end, you will have built a multi-threaded Web server that is capable of processing multiple simultaneous

More information

How To Understand The Architecture Of Java 2Ee, J2Ee, And J2E (Java) In A Wordpress Blog Post

How To Understand The Architecture Of Java 2Ee, J2Ee, And J2E (Java) In A Wordpress Blog Post Understanding Architecture and Framework of J2EE using Web Application Devadrita Dey Sarkar,Anavi jaiswal, Ankur Saxena Amity University,UTTAR PRADESH Sector-125, Noida, UP-201303, India Abstract: This

More information

Java EE Introduction, Content. Component Architecture: Why and How Java EE: Enterprise Java

Java EE Introduction, Content. Component Architecture: Why and How Java EE: Enterprise Java Java EE Introduction, Content Component Architecture: Why and How Java EE: Enterprise Java The Three-Tier Model The three -tier architecture allows to maintain state information, to improve performance,

More information

SSC - Web applications and development Introduction and Java Servlet (II)

SSC - Web applications and development Introduction and Java Servlet (II) SSC - Web applications and development Introduction and Java Servlet (II) Shan He School for Computational Science University of Birmingham Module 06-19321: SSC Outline Outline of Topics Servlet Configuration

More information

Arjun V. Bala Page 20

Arjun V. Bala Page 20 12) Explain Servlet life cycle & importance of context object. (May-13,Jan-13,Jun-12,Nov-11) Servlet Life Cycle: Servlets follow a three-phase life cycle, namely initialization, service, and destruction.

More information

Web Application Programmer's Guide

Web Application Programmer's Guide Web Application Programmer's Guide JOnAS Team ( Florent BENOIT) - March 2009 - Copyright OW2 consortium 2008-2009 This work is licensed under the Creative Commons Attribution-ShareAlike License. To view

More information

Penetration from application down to OS

Penetration from application down to OS April 8, 2009 Penetration from application down to OS Getting OS access using IBM Websphere Application Server vulnerabilities Digitаl Security Research Group (DSecRG) Stanislav Svistunovich research@dsecrg.com

More information

Announcements. Comments on project proposals will go out by email in next couple of days...

Announcements. Comments on project proposals will go out by email in next couple of days... Announcements Comments on project proposals will go out by email in next couple of days... 3-Tier Using TP Monitor client application TP monitor interface (API, presentation, authentication) transaction

More information

Complete Java Web Development

Complete Java Web Development Complete Java Web Development JAVA-WD Rev 11.14 4 days Description Complete Java Web Development is a crash course in developing cutting edge Web applications using the latest Java EE 6 technologies from

More information

DTS Web Developers Guide

DTS Web Developers Guide Apelon, Inc. Suite 202, 100 Danbury Road Ridgefield, CT 06877 Phone: (203) 431-2530 Fax: (203) 431-2523 www.apelon.com Apelon Distributed Terminology System (DTS) DTS Web Developers Guide Table of Contents

More information

JBoss SOAP Web Services User Guide. Version: 3.3.0.M5

JBoss SOAP Web Services User Guide. Version: 3.3.0.M5 JBoss SOAP Web Services User Guide Version: 3.3.0.M5 1. JBoss SOAP Web Services Runtime and Tools support Overview... 1 1.1. Key Features of JBossWS... 1 2. Creating a Simple Web Service... 3 2.1. Generation...

More information

J2EE Web Development. Agenda. Application servers. What is J2EE? Main component types Application Scenarios J2EE APIs and Services.

J2EE Web Development. Agenda. Application servers. What is J2EE? Main component types Application Scenarios J2EE APIs and Services. J2EE Web Development Agenda Application servers What is J2EE? Main component types Application Scenarios J2EE APIs and Services Examples 1 1. Application Servers In the beginning, there was darkness and

More information

Model-View-Controller. and. Struts 2

Model-View-Controller. and. Struts 2 Model-View-Controller and Struts 2 Problem area Mixing application logic and markup is bad practise Harder to change and maintain Error prone Harder to re-use public void doget( HttpServletRequest request,

More information

Java 2 Web Developer Certification Study Guide Natalie Levi

Java 2 Web Developer Certification Study Guide Natalie Levi SYBEX Sample Chapter Java 2 Web Developer Certification Study Guide Natalie Levi Chapter 8: Thread-Safe Servlets Copyright 2002 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. World rights

More information

CS108, Stanford Handout #33 Young. HW5 Web

CS108, Stanford Handout #33 Young. HW5 Web CS108, Stanford Handout #33 Young HW5 Web In this assignment we ll build two separate web projects. This assignment is due the evening of Tuesday November 3 rd at Midnight. You cannot take late days on

More information

Multiple vulnerabilities in Apache Foundation Struts 2 framework. Csaba Barta and László Tóth

Multiple vulnerabilities in Apache Foundation Struts 2 framework. Csaba Barta and László Tóth Multiple vulnerabilities in Apache Foundation Struts 2 framework Csaba Barta and László Tóth 12. June 2008 Content Content... 2 Summary... 3 Directory traversal vulnerability in static content serving...

More information

Web Programming with Java Servlets

Web Programming with Java Servlets Web Programming with Java Servlets Leonidas Fegaras University of Texas at Arlington Web Data Management and XML L3: Web Programming with Servlets 1 Database Connectivity with JDBC The JDBC API makes it

More information

JBoss Portlet Container. User Guide. Release 2.0

JBoss Portlet Container. User Guide. Release 2.0 JBoss Portlet Container User Guide Release 2.0 1. Introduction.. 1 1.1. Motivation.. 1 1.2. Audience 1 1.3. Simple Portal: showcasing JBoss Portlet Container.. 1 1.4. Resources. 1 2. Installation. 3 2.1.

More information

INTRODUCTION TO WEB TECHNOLOGY

INTRODUCTION TO WEB TECHNOLOGY UNIT-I Introduction to Web Technologies: Introduction to web servers like Apache1.1, IIS, XAMPP (Bundle Server), WAMP Server(Bundle Server), handling HTTP Request and Response, installation of above servers

More information

Building Web Services with Apache Axis2

Building Web Services with Apache Axis2 2009 Marty Hall Building Web Services with Apache Axis2 Part I: Java-First (Bottom-Up) Services Customized Java EE Training: http://courses.coreservlets.com/ Servlets, JSP, Struts, JSF/MyFaces/Facelets,

More information

Java Server Pages combined with servlets in action. Generals. Java Servlets

Java Server Pages combined with servlets in action. Generals. Java Servlets Java Server Pages combined with servlets in action We want to create a small web application (library), that illustrates the usage of JavaServer Pages combined with Java Servlets. We use the JavaServer

More information

Xtreeme Search Engine Studio Help. 2007 Xtreeme

Xtreeme Search Engine Studio Help. 2007 Xtreeme Xtreeme Search Engine Studio Help 2007 Xtreeme I Search Engine Studio Help Table of Contents Part I Introduction 2 Part II Requirements 4 Part III Features 7 Part IV Quick Start Tutorials 9 1 Steps to

More information

Implementing the Shop with EJB

Implementing the Shop with EJB Exercise 2 Implementing the Shop with EJB 2.1 Overview This exercise is a hands-on exercise in Enterprise JavaBeans (EJB). The exercise is as similar as possible to the other exercises (in other technologies).

More information

Hello World Portlet Rendered with JSP for WebSphere Portal Version 4.1

Hello World Portlet Rendered with JSP for WebSphere Portal Version 4.1 1 of 11 16.10.2002 11:41 Hello World Portlet Rendered with JSP for WebSphere Portal Version 4.1 Table of Contents Creating the directory structure Creating the Java code Compiling the code Creating the

More information

Intellicus Single Sign-on

Intellicus Single Sign-on Intellicus Single Sign-on Intellicus Enterprise Reporting and BI Platform Intellicus Technologies info@intellicus.com www.intellicus.com Copyright 2010 Intellicus Technologies This document and its content

More information

Java Server Pages Tutorial

Java Server Pages Tutorial Java Server Pages Tutorial JAVA SERVER PAGES TUTORIAL by tutorialspoint.com tutorialspoint.com ABOUT THE TUTORIAL JSP Tutorial Java Server Pages (JSP) is a server-side programming technology that enables

More information

Oracle Service Bus Examples and Tutorials

Oracle Service Bus Examples and Tutorials March 2011 Contents 1 Oracle Service Bus Examples... 2 2 Introduction to the Oracle Service Bus Tutorials... 5 3 Getting Started with the Oracle Service Bus Tutorials... 12 4 Tutorial 1. Routing a Loan

More information

7 Web Databases. Access to Web Databases: Servlets, Applets. Java Server Pages PHP, PEAR. Languages: Java, PHP, Python,...

7 Web Databases. Access to Web Databases: Servlets, Applets. Java Server Pages PHP, PEAR. Languages: Java, PHP, Python,... 7 Web Databases Access to Web Databases: Servlets, Applets Java Server Pages PHP, PEAR Languages: Java, PHP, Python,... Prof. Dr. Dietmar Seipel 837 7.1 Access to Web Databases by Servlets Java Servlets

More information

Lab Experience 17. Programming Language Translation

Lab Experience 17. Programming Language Translation Lab Experience 17 Programming Language Translation Objectives Gain insight into the translation process for converting one virtual machine to another See the process by which an assembler translates assembly

More information

PowerTier Web Development Tools 4

PowerTier Web Development Tools 4 4 PowerTier Web Development Tools 4 This chapter describes the process of developing J2EE applications with Web components, and introduces the PowerTier tools you use at each stage of the development process.

More information

Web Frameworks and WebWork

Web Frameworks and WebWork Web Frameworks and WebWork Problem area Mixing application logic and markup is bad practise Harder to change and maintain Error prone Harder to re-use public void doget( HttpServletRequest request, HttpServletResponse

More information

A Sample OFBiz application implementing remote access via RMI and SOAP Table of contents

A Sample OFBiz application implementing remote access via RMI and SOAP Table of contents A Sample OFBiz application implementing remote access via RMI and SOAP Table of contents 1 About this document... 2 2 Introduction... 2 3 Defining the data model... 2 4 Populating the database tables with

More information

CHAPTER 9: SERVLET AND JSP FILTERS

CHAPTER 9: SERVLET AND JSP FILTERS Taken from More Servlets and JavaServer Pages by Marty Hall. Published by Prentice Hall PTR. For personal use only; do not redistribute. For a complete online version of the book, please see http://pdf.moreservlets.com/.

More information

Developing Web Views for VMware vcenter Orchestrator

Developing Web Views for VMware vcenter Orchestrator Developing Web Views for VMware vcenter Orchestrator vcenter Orchestrator 5.1 This document supports the version of each product listed and supports all subsequent versions until the document is replaced

More information

Working With Virtual Hosts on Pramati Server

Working With Virtual Hosts on Pramati Server Working With Virtual Hosts on Pramati Server 13 Overview Virtual hosting allows a single machine to be addressed by different names. There are two ways for configuring Virtual Hosts. They are: Domain Name

More information

CONTROLLING WEB APPLICATION BEHAVIOR WITH

CONTROLLING WEB APPLICATION BEHAVIOR WITH CONTROLLING WEB APPLICATION BEHAVIOR WITH WEB.XML Chapter Topics in This Chapter Customizing URLs Turning off default URLs Initializing servlets and JSP pages Preloading servlets and JSP pages Declaring

More information

Tutorial: Building a Web Application with Struts

Tutorial: Building a Web Application with Struts Tutorial: Building a Web Application with Struts Tutorial: Building a Web Application with Struts This tutorial describes how OTN developers built a Web application for shop owners and customers of the

More information

Web Programming II JSP (Java Server Pages) ASP request processing. The Problem. The Problem. Enterprise Application Development using J2EE

Web Programming II JSP (Java Server Pages) ASP request processing. The Problem. The Problem. Enterprise Application Development using J2EE Enterprise Application Development using J2EE Shmulik London Lecture #6 Web Programming II JSP (Java Server Pages) How we approached it in the old days (ASP) Multiplication Table Multiplication

More information

LabVIEW Internet Toolkit User Guide

LabVIEW Internet Toolkit User Guide LabVIEW Internet Toolkit User Guide Version 6.0 Contents The LabVIEW Internet Toolkit provides you with the ability to incorporate Internet capabilities into VIs. You can use LabVIEW to work with XML documents,

More information

Java Web Programming. Student Workbook

Java Web Programming. Student Workbook Student Workbook Java Web Programming Mike Naseef, Jamie Romero, and Rick Sussenbach Published by ITCourseware, LLC., 7245 South Havana Street, Suite 100, Centennial, CO 80112 Editors: Danielle Hopkins

More information

Title Page. Hosted Payment Page Guide ACI Commerce Gateway

Title Page. Hosted Payment Page Guide ACI Commerce Gateway Title Page Hosted Payment Page Guide ACI Commerce Gateway Copyright Information 2008 by All rights reserved. All information contained in this documentation, as well as the software described in it, is

More information

Application Security

Application Security 2009 Marty Hall Declarative Web Application Security Originals of Slides and Source Code for Examples: http://courses.coreservlets.com/course-materials/msajsp.html Customized Java EE Training: http://courses.coreservlets.com/

More information

Drupal CMS for marketing sites

Drupal CMS for marketing sites Drupal CMS for marketing sites Intro Sample sites: End to End flow Folder Structure Project setup Content Folder Data Store (Drupal CMS) Importing/Exporting Content Database Migrations Backend Config Unit

More information

Development. with NetBeans 5.0. A Quick Start in Basic Web and Struts Applications. Geertjan Wielenga

Development. with NetBeans 5.0. A Quick Start in Basic Web and Struts Applications. Geertjan Wielenga Web Development with NetBeans 5.0 Quick Start in Basic Web and Struts pplications Geertjan Wielenga Web Development with NetBeans 5 This tutorial takes you through the basics of using NetBeans IDE 5.0

More information

Introduction to Web Technologies

Introduction to Web Technologies Secure Web Development Teaching Modules 1 Introduction to Web Technologies Contents 1 Concepts... 1 1.1 Web Architecture... 2 1.2 Uniform Resource Locators (URL)... 3 1.3 HTML Basics... 4 1.4 HTTP Protocol...

More information

Grandstream XML Application Guide Three XML Applications

Grandstream XML Application Guide Three XML Applications Grandstream XML Application Guide Three XML Applications PART A Application Explanations PART B XML Syntax, Technical Detail, File Examples Grandstream XML Application Guide - PART A Three XML Applications

More information

Creating Custom Web Pages for cagrid Services

Creating Custom Web Pages for cagrid Services Creating Custom Web Pages for cagrid Services Creating Custom Web Pages for cagrid Services Contents Overview Changing the Default Behavior Subclassing the AXIS Servlet Installing and Configuring the Custom

More information

Building Web Applications, Servlets, JSP and JDBC

Building Web Applications, Servlets, JSP and JDBC Building Web Applications, Servlets, JSP and JDBC Overview Java 2 Enterprise Edition (JEE) is a powerful platform for building web applications. The JEE platform offers all the advantages of developing

More information

Introduction to web development using XHTML and CSS. Lars Larsson. Today. Course introduction and information XHTML. CSS crash course.

Introduction to web development using XHTML and CSS. Lars Larsson. Today. Course introduction and information XHTML. CSS crash course. using CSS using CSS 1 using CSS 2 3 4 Lecture #1 5 6 using CSS Material using CSS literature During this, we will cover server side web with JavaServer Pages. JSP is an exciting technology that lets developers

More information

Principles and Techniques of DBMS 5 Servlet

Principles and Techniques of DBMS 5 Servlet Principles and Techniques of DBMS 5 Servlet Haopeng Chen REliable, INtelligentand Scalable Systems Group (REINS) Shanghai Jiao Tong University Shanghai, China http://reins.se.sjtu.edu.cn/~chenhp e- mail:

More information

Oracle Hyperion Financial Management Developer and Customization Guide

Oracle Hyperion Financial Management Developer and Customization Guide Oracle Hyperion Financial Management Developer and Customization Guide CONTENTS Overview... 1 Financial Management SDK... 1 Prerequisites... 2 SDK Reference... 2 Steps for running the demo application...

More information

SSC - Web development Model-View-Controller for Java web application development

SSC - Web development Model-View-Controller for Java web application development SSC - Web development Model-View-Controller for Java web application development Shan He School for Computational Science University of Birmingham Module 06-19321: SSC Outline Outline of Topics Java Server

More information

Course Name: Course in JSP Course Code: P5

Course Name: Course in JSP Course Code: P5 Course Name: Course in JSP Course Code: P5 Address: Sh No BSH 1,2,3 Almedia residency, Xetia Waddo Duler Mapusa Goa E-mail Id: ITKP@3i-infotech.com Tel: (0832) 2465556 (0832) 6454066 Course Code: P5 3i

More information

Web Development. Owen Sacco. ICS2205/ICS2230 Web Intelligence

Web Development. Owen Sacco. ICS2205/ICS2230 Web Intelligence Web Development Owen Sacco ICS2205/ICS2230 Web Intelligence Introduction Client-Side scripting involves using programming technologies to build web pages and applications that are run on the client (i.e.

More information

Data Mailbox. support.ewon.biz. Reference Guide

Data Mailbox. support.ewon.biz. Reference Guide Reference Guide RG 005-0-EN / Rev. 1.0 Data Mailbox The Data Mailbox is a Talk2M service that gathers ewon historical data and makes it available for third party applications in an easy way. support.ewon.biz

More information

THE CHALLENGE OF ADMINISTERING WEBSITES OR APPLICATIONS THAT REQUIRE 24/7 ACCESSIBILITY

THE CHALLENGE OF ADMINISTERING WEBSITES OR APPLICATIONS THAT REQUIRE 24/7 ACCESSIBILITY THE CHALLENGE OF ADMINISTERING WEBSITES OR APPLICATIONS THAT REQUIRE 24/7 ACCESSIBILITY As the constantly growing demands of businesses and organizations operating in a global economy cause an increased

More information

How to use JavaMail to send email

How to use JavaMail to send email Chapter 15 How to use JavaMail to send email Objectives Applied Knowledge How email works Sending client Mail client software Receiving client Mail client software SMTP Sending server Mail server software

More information

Web Development on the SOEN 6011 Server

Web Development on the SOEN 6011 Server Web Development on the SOEN 6011 Server Stephen Barret October 30, 2007 Introduction Systems structured around Fowler s patterns of Enterprise Application Architecture (EAA) require a multi-tiered environment

More information

Oracle Hyperion Financial Management Custom Pages Development Guide

Oracle Hyperion Financial Management Custom Pages Development Guide Oracle Hyperion Financial Management Custom Pages Development Guide CONTENTS Overview... 2 Custom pages... 2 Prerequisites... 2 Sample application structure... 2 Framework for custom pages... 3 Links...

More information

Building Web Applications with Servlets and JavaServer Pages

Building Web Applications with Servlets and JavaServer Pages Building Web Applications with Servlets and JavaServer Pages David Janzen Assistant Professor of Computer Science Bethel College North Newton, KS http://www.bethelks.edu/djanzen djanzen@bethelks.edu Acknowledgments

More information

Capario B2B EDI Transaction Connection. Technical Specification for B2B Clients

Capario B2B EDI Transaction Connection. Technical Specification for B2B Clients Capario B2B EDI Transaction Connection Technical Specification for B2B Clients Revision History Date Version Description Author 02/03/2006 Draft Explanation for external B2B clients on how to develop a

More information

Development of Web Applications

Development of Web Applications Development of Web Applications Principles and Practice Vincent Simonet, 2013-2014 Université Pierre et Marie Curie, Master Informatique, Spécialité STL 3 Server Technologies Vincent Simonet, 2013-2014

More information

Chulalongkorn University International School of Engineering Department of Computer Engineering 2140105 Computer Programming Lab.

Chulalongkorn University International School of Engineering Department of Computer Engineering 2140105 Computer Programming Lab. Chulalongkorn University Name International School of Engineering Student ID Department of Computer Engineering Station No. 2140105 Computer Programming Lab. Date Lab 2 Using Java API documents, command

More information