Web Server Programming 3 Server side includes HTML

Web Server Programming 3. Server side includes

HTML+ (‘hole’) technologies Uses ‘HTML+”, HTML (or XML) extended with code. Very many different varieties. • SSI (Server Side Includes) (Apache) • PHP (‘Personal Home Page’) • HTML + code (SSI, PHP, ASP, etc. )

Server Side Includes • Program fragments mixed with text • Allow parts of documents to be generated dynamically • Executed by server (not by client)

Server Side Includes • • • SSI (http: //httpd. apache. org/docs/mod_include. html) PHP (http: //www. php. net/) ASP (http: //stardeveloper. com: 8080/articles/041600 -1. shtml) JSP (http: //java. sun. com/products/jsp/index. html) XSP (http: //xml. apache. org/cocoon/xsp. html) • Cold. Fusion (http: //www. macromedia. com/software/coldfusion/)

Principles & Implementations Reinier

JSP • • SUN standard For HTML or XML Processing instruction tags XML extensions: – predefined ‘<jsp: set. Property. . />’, etc. – custom • Uses JAVA • Gives access to Servlet packages

Most Important JSP Tags • • <%@page import=“java. io, java. util” %> <%@include file=“relative. URL” %> <%!String name; %> <% name=request. get. Parameter(“name”); %> • <%= name %> • <%-- comment --%>

HTML Interleaving <% for (int i = 0; i < 10; i++) { %> <td><a href= <%= “”” + url. Prefix + i + “”” %> >text</a></td> <% } %>

Implicit Objects • • • config – Servlet. Config object request – Servlet. Request object response – Servlet. Response object application – Servlet. Context object session – Http. Session object out – Writer for output data

JSP + XML • Alternative syntax: – JSP: <% a = b; %> – XML: <jsp: scriptlet> a = b; </jsp: scriptlet> • Tag libraries – <%@ taglib uri=“pqr” prefix=“stu”> – <stu: loop> … </stu: loop> • Directives – <jsp: plugin type=“applet” code=“xyz” …

ASP • • • Microsoft product Extends HTML pages Tags: <% and %> Uses VBScript, Perl. Script (=Perl) or Jscript Built-in objects: Application, ASPError, Request, Response, Server, Session

ASP versus JSP ASP • Microsoft license • IIS or PWS • Interpreted • Active. X components • HTML+ • Fixed tags JSP • SUN open standard • Apache, etc. • Compiled (JIT) • Java. Beans • HTML+, XML • Extensible tags

Assignment 3 • Translate servlet WCHelp to a JSP page in such a way that each time it is activated a different text is shown.

XML-based Web Programming • WSDL: Web Services Description Language (services + ports + messages) • UDDI: Universal Description, Discovery and Integration (registry) • XML-based Remote Procedure Calls (SOAP) (protocol)

Cocoon • Uses XML data • Uses XSLT transformations • Pipelining of operations

More Information • J 2 EE tutorial: http: //java. sun. com/j 2 ee/1. 4/docs/tutorial/doc/inde x. html • Servlet API: http: //java. sun. com/j 2 ee/1. 4/docs/api/index. html • JSP specification: http: //java. sun. com/products/jsp/index. jsp#specs
- Slides: 16