CITA 310 Section 7
Installing and Testing a Programming Environment
(Textbook Chapter 7)
The Need for Programming Languages Web pages with just HTML
statements are static pages Pages that contain programming
statements allow changes and they are called dynamic pages
Programming languages can also be used to update databases and communicate with other systems
Web-based Programming Environment Common Gateway Interface (CGI)
A protocol that allows the operating system to interact with the Web server
Practical extraction and reporting language (Perl) First popular language for Web servers
Java Server Pages (JSP) Language similar to Java
Web-based Programming Environment
Active Server Pages (ASP) Script-based environment available on all IIS
Web servers ASP.NET
Compiled programs operate under .NET Framework
PHP Hypertext Protocol (PHP) Popular language available on most platforms
The structure of JSP, ASP, and PHP are similar
Using Forms The following HTML produces a form
When the submit button is pressed, the data in the form is sent to the file designated as filename
Using ASP to Process a Form
The following file displays the information from the form
Notice how the items such as "first" match the text names on the form
ASP uses <% and %> for opening and closing tags <%=request()%> is one way to retrieve data from the
form
ASP.NET ASP.NET is one of the many
languages available under the .NET Framework that can be used for the Web
The programming model of ASP.NET is superior to that of ASP Has modules for data validation that
differentiates between browsers Producing sophisticated reports is much
easier
ASP.NET Program that Combines Form and Output
Perl Script to Display Contents of a Form Notice how $cgi->param("first") is
similar to ASP’s request("first")
Programming with Databases
Microsoft uses two methods to bridge the gap between programming languages and databases Open Database Connectivity (ODBC)
The original standard Object Linking and Embedding Database
(OLEDB) Current standard which is faster and more flexible
Linux often uses Java Database Connectivity (JDBC)
You can also have a direct connection between the language (such as PHP) and the database (such as MySQL)
Producing a Report Connect to the database Execute a SQL select statement to
retrieve data from a table Put the data in a recordset
Also known as a resultset, depending on the environment
Loop through the recordset and display the contents
A Report in ASP
Using Data Source Names (DSNs) DSNs are connections to databases that
an administrator creates on the server They encapsulate the information on
the previous slide concerning the connection information
The Data Sources (ODBC) wizard is in the Control Panel
Once it is created, you can create a connection withConn.open "DSN=humanresources;uid=sa"
Programming with ASP.NET
Although there is a connection and you send it a SQL select statement, the DataGrid component creates the report
Programming with PHP Note the
similarity between ASP and PHP, and how different they are from ASP.NET
Warning: Codes poorly written
Installing PHP in Apache You may insert the following lines
into your Apache httpd.conf configuration file to load the PHP module for Apache 2.2:
LoadModule php5_module "C:/php/php5apache2_2.dll"
AddHandler application/x-httpd-php .phpPHPIniDir "C:/php"
Server-Side Includes (SSI) SSI provide a means to add
dynamic content to existing HTML documents.
SSI directives have the following syntax:
<!--#element attribute=value attribute=value ... -->