cs 607 web programming

38
CS 607 Web Programming http://www.cs.ucc.ie/ j.bowen/cs607/

Post on 20-Dec-2015

216 views

Category:

Documents


0 download

TRANSCRIPT

CS 607

Web Programming

http://www.cs.ucc.ie/j.bowen/cs607/

http://www.cs.ucc.ie/j.bowen/cs607/

Assumptions

• You have had no formal training in web programming

• But it is assumed that you have picked up a lot of relevant material already

• Nevertheless, the course will review basic notions, to ensure a “level playing field”

Servers and Browsers

• Servers make web documents, which are specified in HTML, available on request to browsers

• Browsers display, to users, web documents which have been received from servers

Servers and Browsers

Web Programming

• Programming for the World Wide Web involves both– server-side programming, and– client-side (browser-side) programming

Client-side programming

• In this module, we will consider the following mechanisms for client-side programming:– HTML 4.0– Cascading Style Sheets– Javascript– Java applets

Server-side Programming

• In this module, we will consider – the Hyper Text Transfer Protocol (HTTP)– the Common Gateway Interface (CGI) protocol

for sending information between servers and appln programs running on the same machines

– server-side programming in Perl, PHP and Java

Other topics

• We will also consider– user-interface design– security

Assessment

• Of the marks available for the module,– 70% are available from the end-of-year written

examination– 30% are available from continuous assessment,

a series of in-class tests that will be administered from time to time

HTML: HyperText Markup Language

Assumption

• It is assumed that you have already used HTML quite a bit, even though you have had no formal course in it

• Beware that good HTML programming methodology is still evolving

• This course will adhere rigidly to the latest standards for coding in HTML 4.0, even though browsers tend to be more tolerant

• HTML is the language used for specifying WWW documents

• A specification, in HTML, of a WWW document contains raw content (text, video, etc.) along with items called tags which are used to tell browsers about the content

HTML Specification of a Simple Document

<HTML> <HEAD> <TITLE> Hello Document </TITLE> </HEAD> <BODY> Hello there </BODY> </HTML>

Viewing this document using Netscape

• The HTML fragment <TITLE> Hello Document </TITLE> tells the browser what title to place on the top line

of the browser display

• The HTML fragment <BODY> Hello there </BODY> tells the browser what to put in its content display region

Viewing the document using Explorer

Browsers treat documents slightly differently

• See how the document titles are placed differently on the top line of the browser

• See how the content display regions have different colours

Testing your web-site

• When you make you web-site live, it may be accessed by anybody on the WWW

• You have no idea which browser they will be using

• But it is a good idea to test you site on the most likely browsers

• Got here on 28 9 2004

The items below are called tags

<HTML> <HEAD> <TITLE> </TITLE> </HEAD> <BODY> </BODY> </HTML>

Notice that tags come in pairs:

A tag pair contains something:

• The tag pair <HTML> … </HTML> contains a HTML specification of a document, including always– “header” information, that is info about the

document– the content of the document

• The tag pair <HEAD> … </HEAD> contains the header information about the document, including– the title of the document (always present)– other information (optional)

• the tag pair <TITLE> … </TTLE> contains the title of the document

• The tag pair <BODY> … </BODY> contains the content of the document

Thus, the simplest HTML specification is of the form:

<HTML>

<HEAD>

<TITLE> Some-title </TITLE>

</HEAD>

<BODY> Some-content </BODY>

</HTML>

Example document spec:

<HTML>

<HEAD>

<TITLE> A silly document </TITLE>

</HEAD>

<BODY> Isn’t this easy???? </BODY>

</HTML>

Another example specification:

<HTML>

<HEAD>

<TITLE> Silly document #2 </TITLE>

</HEAD>

<BODY> Well, well!! </BODY>

</HTML>

Dividing text into paragraphs:

Dividing text into paragraphs<HTML>

<HEAD> <TITLE> The Ironies of History </TITLE> </HEAD>

<BODY>

<P>In August 1914, a bullet was fired in Sarajevo which led,

indirectly, to the deaths of thousands of Congolese in 1999.

The bullet in Sarajevo caused World War I which, in turn, caused

the Russian Revolution. </P>

<P>The Russian Revolution led, eventually, to the Cold War. The Cold

War caused The West to support Mobutu in his kleptocratic rule of

the Congo, leading to such a breakdown of society that the Congo

has experienced a series of civil wars in the late 1990s. </P>

</BODY>

</HTML>

The Paragraph tags:

• The tag <P> is used to start a paragraph while the tag </P> is used to end a paragraph

• Ensure you use the </P> tag at the end of a paragraph:– some browsers do not insist on it but other

programs rely on its presence

• NEVER use a </P> tag to get “white space”

CS 607 got here on 7/10/2003