Chapter 61 Processing the Client Request JavaServer Pages By Xue Bai.

Slides:



Advertisements
Similar presentations
HTML Forms. collect information for passing to server- side processes built up from standard widgets –text-input, radio buttons, check boxes, option lists,
Advertisements

23-Aug-14 HTML/XHTML Forms. 2 What are forms? is just another kind of XHTML/HTML tag Forms are used to create (rather primitive) GUIs on Web pages Usually.
24-Aug-14 HTML Forms. 2 What are forms? is just another kind of HTML tag HTML forms are used to create (rather primitive) GUIs on Web pages Usually the.
Tutorial 6 Creating a Web Form
Lecture 14 HTML Forms CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger.
Video, audio, embed, iframe, HTML Form
Chapter 31 Basic Form-Processing Techniques JavaServer Pages By Xue Bai.
Creating Web Page Forms. Objectives Describe how Web forms can interact with a server-based program Insert a form into a Web page Create and format a.
Tutorial 6 Working with Web Forms
Forms Review. 2 Using Forms tag  Contains the form elements on a web page  Container tag tag  Configures a variety of form elements including text.
Form Basics CS Web Data  Most interesting web pages revolve around data  examples: Google, IMDB, Digg, Facebook, YouTube, Rotten Tomatoes  can.
1 Static Web Pages Websites on Servers (The Big Picture) –Apache Tomcat can support static web pages –Primarily intended to support servlets and JSP –Some.
USER INTERACTIONS: FORMS
Tutorial 6 Working with Web Forms. XP Objectives Explore how Web forms interact with Web servers Create form elements Create field sets and legends Create.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic Table, Forms, Metatags and Frames.
Creating Web Page Forms
Chapter 10 Form Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
4-Sep-15 HTML Forms Mrs. Goins Web Design Class. Parts of a Web Form A Form is an area that can contain Form Control/Elements. Each piece of information.
XP Tutorial 6New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Creating Web Page Forms Designing a Product Registration Form Tutorial.
XP Tutorial 6New Perspectives on HTML and XHTML, Comprehensive 1 Creating Web Page Forms Designing a Product Registration Form Tutorial 6.
1 Creating Web Forms in HTML Web forms collect information from customers Web forms include different control elements including: –Input boxes –Selection.
Web111a_chapt06.ppt HTML: Section 6 Forms HTML tags: define data input and/or output Define the Input and/or Output on the web page Do not process the.
1 Forms A form is the usual way that information is gotten from a browser to a server –HTML has tags to create a collection of objects that implement this.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
XHTML Introductory1 Forms Chapter 7. XHTML Introductory2 Objectives In this chapter, you will: Study elements Learn about input fields Use the element.
HTML II. Factors to consider in designing a website. Organizing your files. HTML Tables. Unordered Lists. Ordered Lists. HTML Forms. Learning Objectives.
Forms Sangeetha Parthasarathy 02/05/2001. Introduction to Forms A form makes it possible to transform your web pages from text to graphics to interactive.
Creating a Web Site to Gather Data and Conduct Research.
Robinson_CIS_285_2005 HTML FORMS CIS 285 Winter_2005 Instructor: Mary Robinson.
Chapter 5 HTTP Request Headers. Content 1.Request headers 2.Reading Request Headers 3.Making a Table of All Request Headers 4.Sending Compressed Web Pages.
CSC 2720 Building Web Applications HTML Forms. Introduction  HTML forms are used to collect user input.  The collected input is typically sent to a.
Chapter 8 Cookies And Security JavaScript, Third Edition.
JavaScript, Fourth Edition Chapter 5 Validating Form Data with JavaScript.
Chapter 2 XHTML: Part II The Web Warrior Guide to Web Design Technologies.
 2008 Pearson Education, Inc. All rights reserved Introduction to XHTML.
LOGO FORMs in HTML CHAPTER 5 Eastern Mediterranean University School of Computing and Technology Department of Information Technology ITEC229 Client-Side.
Week 9 - Form Basics Key Concepts 1. 1.Describe common uses of forms on web pages 2.Create forms on web pages using the form, input, textarea, and select.
ITCS373: Internet Technology Lecture 5: More HTML.
Tutorial 6 Working with Web Forms. XP Objectives Explore how Web forms interact with Web servers Create form elements Create field sets and legends Create.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
7 Chapter Seven Client-side Scripts. 7 Chapter Objectives Create HTML forms Learn about client-side scripting languages Create a client-side script using.
1 Review of Form Elements. 2 The tag Used in between tags.  Form elements(text control, buttons, etc.. ) goes here. OR  Form elements(text control,
Session 8: Working with Form iNET Academy Open Source Web Development.
HTML Forms a form is a container for input elements on a web page input elements contain data that is sent to the web server for processing.
Forms Collecting Data CSS Class 5. Forms Create a form Add text box Add labels Add check boxes and radio buttons Build a drop-down list Group drop-down.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
+ FORMS HTML forms are used to pass data to a server. begins and ends a form Forms are made up of input elements Every input element has a name and value.
©SoftMooreSlide 1 Introduction to HTML: Forms ©SoftMooreSlide 2 Forms Forms provide a simple mechanism for collecting user data and submitting it to.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
Project 6 Creating Forms on a Web Page. Objectives Define terms related to forms Describe the different form controls and their uses Use the tag Create.
Creating Web Page Forms COE 201- Computer Proficiency.
Netprog CGI and Forms1 CGI and Forms A detailed look at HTML forms.
Week 10: HTML Forms HNDIT11062 – Web Development.
HTML FORMS Basharat Mahmood, Department of Computer Science,CIIT,Islamabad,Pakistan. 1.
HTML Forms. A form is simply an area that can contain form fields. Form fields are objects that allow the visitor to enter information - for example text.
Creating Forms on a Web Page. 2 Introduction  Forms allow Web developers to collect visitor feedback  Forms create an environment that invites people.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
HTML FORM. Form HTML Forms are used to select different kinds of user input. HTML forms are used to pass data to a server. A form can contain input elements.
HTML Structure II (Form) WEEK 2.2. Contents Table Form.
Ashima Wadhwa Java Script And Forms. Introduction Forms: –One of the most common Web page elements used with JavaScript –Typical forms you may encounter.
XP Tutorial 6New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Creating Web Page Forms Designing a Product Registration Form Tutorial 6.
2440: 141 Web Site Administration Web Forms Instructor: Joseph Nattey.
How to Write Web Forms By Mimi Opkins.
Objectives Design a form Create a form Create text fields
Basic XHTML Tables XHTML tables—a frequently used feature that organizes data into rows and columns. Tables are defined with the table element. Table.
FORM OBJECT When creating an interactive web site for the Internet it is necessary to capture user input and process this input. Based on the result of.
Presentation transcript:

Chapter 61 Processing the Client Request JavaServer Pages By Xue Bai

Chapter 62 Objectives In this chapter, you will: Obtain header information using the request object Get client and server information using the request object Process form input fields Get and use array containing all values of a single input field Control output stream

Chapter 63 The Implicit Objects There are a number of objects made available by the JSP container These objects are called implicit objects, because you can use them without explicitly declaring them in your page These objects are instances of classes defined by the servlet and JSP specifications Request, response, out, session, application, and exception

Chapter 64 Request object Each time you request a JSPpage, the JSP container creates a new instance of the request object The object contains information about the request and the invoked page, including headers, client and server information, request URL, cookies, session, and input data

Chapter 65 Header Information HTTP requests can have a number of associated HTTP headers These headers provide some extra information about the request You can use the header information to customize the content you send to client

Chapter 66 Header Name Description AcceptSpecify the media type, Multipurpose Internet Multimedia Extensions (MIME), the client prefers to accept. All media types are separated by commas. For example, the image format a browser prefers. User-AgentGives information about the client software, including the browser name and version as well as information about the client computer. For example, Mozilla/4.0 (compatible; MSIE 6.0b; Windows NT 5.1) indicates it is Microsoft Internet Explorer running on Windows XP. ReferrerGives the URL of the document that refers to the requested URL (that is, the document that contains the link the client followed to access this document). Accept- Language The default language setting on the client machine

Chapter 67 Get Header Information –It returns a string containing information about the header passed as a parameter request.getHeader(“header name”); Example: –The string returned by request.getHeader(“accept- language”) indicates the default language setting on the client machine The method request.getHeaderNames() returns an enumeration of all header names on the current request

Chapter 68 Header Information

Chapter 69 Determine Browser Type You are using Internet Explorer You are using Netscape Navigator You are using a browser other than Netscape Navigator or Internet Explorer

Chapter 610 Example2.jsp Displayed in Internet Explorer

Chapter 611 Example2.jsp Displayed in Netscape Navigator

Chapter 612 Get Client and Server Information The request object provides various methods to get client computer name and IP, Web server name, and Web server port Client computer name: Client computer IP address: The Web server name: The running port number of Web server:

Chapter 613 Form Collection Use input elements to collect data: –These input elements include text, password, text area, hidden, select, checkbox, and radio inputs

Chapter 614 Text Field Accept single-line information –maxlength—Sets the maximum allowable length of the field, in characters –size—Sets the width, in characters, of the input box that appears on the page –value—Sets initial value for the text field <input type=”text” name=”state” size=”4” maxlength=”2” value=”VA”>

Chapter 615 Password Field Characters are converted to asterisk or bullet symbols for privacy

Chapter 616 Hidden Field Another type of txt field, but they are not displayed Used to send data to the Web server that cannot be changed by users Often used to pass data from one page to another

Chapter 617 TextArea Accept multiple lines <TextArea name=”fieldname” rows=”numberOfRows” cols=”numberOfColumns”> optional initial value The rows and cols attributes are used to control the number of rows and columns displayed

Chapter 618 Select Fields Provide a list of options from which the user may select A drop down list box Option1 text …additional options The size attribute controls how many lines are visible at one time The multiple attribute controls whether users may select multiple items from the list

Chapter 619 Checkboxes A small box that users click to place or remove a check mark <input type=checkbox name=”fieldname” value=”a value” CHECKED>Descriptive text

Chapter 620 Radio Buttons Present a range of choices Only one button in a group is selected at one time <input type=radio name=”fieldname” value=”field value” checked>Descriptive text

Chapter 621 Example 6.jsp Gender: Female Male What types of music do you listen to? Rock Jazz Classical Pop

Chapter 622 Working with Checkboxes and Radio Buttons

Chapter 623 Working with Array Deal with multiple values associated with a single field on a form The method request.getParameterValues (“elementName”) returns a string array containing all values associated with the element

Chapter 624 Processing Array String music[] = request.getParameterValues(“music”); if(music != null && music.length != 0){ out.println(“Music types you listen to: ”); for(int i=0; i<music.length; i++){ out.println(music[i] + “ ”); }

Chapter 625 List All Control Names The method: Request.getParameterNames() Returns an enumeration object containing all control names on the request

Chapter 626 Response Object The response object controls output that the server sends to the client It is an instance of the javax.servlet.http.ServletResponse class (which is imported automatically when your JSP page is converted into a servlet) The response object provides methods that you can use in your JSP script to set headers, add cookies, and control how information is returned to clients Various methods of the response object are discussed throughout the book when they are introduced

Chapter 627 Cookies A small piece of textual information stored on the client machine A name and value pair Attributes include: maximumAge, domain, and path

Chapter 628 Out Object Used to send an output stream to the client

Chapter 629 Flushing Buffered Content Force buffered content to be flushed, regardless of the specified buffer size out.flush();

Chapter 630 Clearing the Buffer Erase the buffered content out.cler(); out.clearBuffer();

Chapter 631 Closing the Output Stream Close output stream Before closing output stream, the buffered content is flushed out.close();

Chapter 632 Control Output Stream Explicitly close output stream Messages before closing output stream. Close output stream now. <% out.close(); %> output stream has been closed. So this content will not be sent to client

Chapter 633 Closing the Output Stream