ch24 - Chapter Twenty-Four: Web Applications Chapter Goals...

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

View Full Document Right Arrow Icon
Chapter Twenty-Four: Web Applications
Background image of page 1

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

View Full DocumentRight Arrow Icon
Chapter Goals To understand the web application concept To learn the syntactical elements of the JavaServer Faces web application framework To learn about navigation in web applications To build three-tier web applications
Background image of page 2
The Architecture of a Web Application The web application program resides on a web server The user interface of the web application is displayed in a web browser User inputs are transmitted over the Internet to the server using the HTTP protocol The server responds by sending a new web page in HTML format Continued
Background image of page 3

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

View Full DocumentRight Arrow Icon
The Architecture of a Web Application (cont.)
Background image of page 4
A Simple Form HTML: <html> <head> <title>A Simple Form</title> </head> <body> <form action="login.jsp"> <p> User name: <input type="text" name="username" /> Password: <input type="password" name="passwd" /> <input type="submit" name="login" value="Log in"/> </p> </form> </body> </html >
Background image of page 5

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

View Full DocumentRight Arrow Icon
A Simple Form Browser view:
Background image of page 6
A Simple Form When the submit button is clicked, the browser sends an HTTP POST request with names and values of form elements: POST /login.jsp HTTP/1.1 Content-Type: application/x-www-form-urlencoded Content-Length: 46 blank line username=jqpublic&passwd=secret&login=Log%20in
Background image of page 7

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

View Full DocumentRight Arrow Icon
Challenges HTTP protocol is stateless Tedious to generate tags for an HTML form Very hard to comprehend response strategies for a large number of request types A web application framework is designed to overcome these challenges E.g. JavaServer Faces (JSF) framework
Background image of page 8
Self Check 24.1 Why are two different protocols (HTML and HTTP) required by a web application? Answer: Each protocol has a specific purpose. HTML describes the appearance of a page; it would be useless for sending requests from a browser to a server. HTTP describes a request; it cannot describe the appearance of a page.
Background image of page 9

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

View Full DocumentRight Arrow Icon
Self Check 24.2 How can a web application know which user is trying to log in when the information of the sample login screen is submitted? Answer: The data of the POST request contain a portion username= the name supplied by the user the password supplied by the user
Background image of page 10
A Simple JSF Program JSF: Java Server Faces To develop a JSF application, you need a web server that is integrated with a JSF container A JSF page contains HTML and JSF tags The user interface of a JSF application is described by a set of JSF pages
Background image of page 11

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

View Full DocumentRight Arrow Icon
A Simple JSF Program Each JSF page has the following structure: <html> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f“ %> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <f:view> <head> <title> Page title </title> </head> <body> <h:form> Page contents </h:form> </body> </f:view> </html>
Background image of page 12
A Simple JSF Program Previous structure has three parts: taglib directives required to locate two JSF libraries • Tags from the core library have the prefix f: (such as f:view ) • Tags from the HTML library have the prefix h: (such as h:form ) All JSF tags must be contained inside an f:view tag The h:form tag encloses all user interface elements
Background image of page 13

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

View Full DocumentRight Arrow Icon
ch24/datetime/index.jsp
Background image of page 14
Image of page 15
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 104

ch24 - Chapter Twenty-Four: Web Applications Chapter Goals...

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

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