1 / 29

CSI315

CSI315. Creating Dynamic Web Pages. Static Web Pages. A page whose content is typed directly into the HTML document. This page every time it is delivered by the web server is the exact same. HTML is usually static “Fixed” text. Nothing moves. The same from visit to visit

roz
Download Presentation

CSI315

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSI315 Creating DynamicWeb Pages

  2. Static Web Pages • A page whose content is typed directly into the HTML document. This page every time it is delivered by the web server is the exact same. • HTML is usually static • “Fixed” text. • Nothing moves. • The same from visit to visit • Not personalized • Just display info. No way to receive info from a customer • How does a static web page gets displayed on a browser?

  3. Static Web Page Delivery Web Server 1 3 Web server locates .htm file Author writes HTML 4 HTML stream returned to browser 5 2 Browser processes page Client requests page Client

  4. “Dynamic” Web Pages • Dynamic web pages are ones that are created on the fly based on user actions or current conditions. • Dynamic pages get us past the problem of static pages • Programs run and do things • Pages are customized per user • Pages behave more like a SW application

  5. Dynamic Web Page Delivery Web Server 3 Web server locates instructions file 1 4 HTML and script are returned to browser Author writes instructions 5 Web browser processes script to create HTML 2 Client requests page 6 Browser displays HTML Client

  6. Dynamic Web Sites • Making a web site dynamic by adding applications • We don’t mean desktop applications like Microsoft Word. Application : Anything that performs a task that allows a user to interact with you or others through your website

  7. Simple Applications • Simple = No Workflow • Single HTML Form/Request • Guestbook • Form Processor/WebResponder • Tell A Friend • Sign up for Monthly Newsletters • Provide Feedback • Simple Ordering

  8. Complex Applications • Complex = Heavier Workflow • WebStore (on-line eCommerce) • On-Line Discussions Forums • Ranging from straightforward forums to the complexities of managing entire communities • Public Chat Engines

  9. Getting the Apps • Three choices • Hire someone • DIY (Do It Yourself) • Download for Free • Or a combination of the above…

  10. Hiring Someone… • People and companies who reuse code can be difficult to find. • But they do exist. • Reusing code efficiently is not necessarily easy so the cost per hour for such a developer may be higher, but the total time will be lower. Hence, you will get faster time to market, lower overall project cost with application reuse.

  11. Hiring Someone… • Could hire a company/freelance developer • The red light should go on if they propose developing something entirely from scratch • Unless your business is really different, there's no need. • Also, any software written from scratch should be considered below version 1. Even version 1 code has bugs. • Therefore, look for following criteria • Companies that use existing external resources • Or promote heavy reuse within their company if proprietary • Preferably go with a company that understands you business • They probably understand what types of bugs crop up with workflow specific to that line of work

  12. Apps For Free • Fortunately, on the web plenty of people are willing to share their work. • We do it, and there are others as well • Major upside: fully functional apps for free • Also, many companies or people you will hire will try to write from scratch • But public stuff has been debugged by a wide audience (includes security debugging)

  13. Apps For Free • The downside to free apps… • Free stuff can appeal to a more techie audience • Look for a site that has good documentation • Free stuff can have varying quality • Linux and Apache are known examples of high quality free software that is less buggy that commercial counterparts. • But not all free software is great just like not all commercial software is great. • Look for a meta-site that rates the various free sites out there...

  14. Technologies • Java Server Pages (JSP) • CGI Common GateWay Interface • Active Server Pages (ASP) • PHP (originally Personal Home Pages, but more recently PHP HyperText Preprocessor) • ColdFusion

  15. Java Technology • Servlets – A technology allowing Java to run inside a web server dynamically • JSPs (Java Server Pages) – A technology to allow Java to be embedded in HTML pages • JSP allows you to combine markup (HTML or XML) with Java code to dynamically generate web pages.

  16. Common Gateway Interface (CGI) • A a mechanism for creating scripts on the server • CGI allows the user to invoke another program (such as a Perl script) on the web server to create the dynamic web page, • Role of CGI is to pass the user supplied data to the this program for processing. • A call to a CGI program is encoded into a HTML document, where it usually appears as a hyperlink. • programming languages that can work well with CGI are C, C++ and Perl. Perl is the most popular with CGI programming

  17. A Typical CGI Interaction

  18. <HTML><HEAD><TITLE>Guestbook</TITLE></HEAD> <BODY> <H1>Fill in my guestbook!</H1> <FORM METHOD="GET" ACTION="/cgi-bin/guestbook.pl"> <PRE> First Name: <INPUT TYPE="TEXT" NAME="firstname"> Last Name: <INPUT TYPE="TEXT" NAME="lastname"> <INPUT TYPE="SUBMIT"> <INPUT TYPE="RESET"> </FORM>

  19. ASP • Developed by Microsoft to add enhanced security, functionality, and database connectivity to pages • Basically ASP are files containing HTML tags, ASP commands, and some other embedded scripting language JavaScript VBScript • Commands to be interpreted by the web server are contained inside of server delimiter tags: <% commands %> • Server delimiters can appear in the HEAD and BODY sections of the web page, as well as inside of tags to create server-processed attribute values

  20. Native ASP Objects ASP pages primarily use commands in other scripting languages (like VBScript or JavaScript), but there are 4 primary ASP native objects • Response • Request • Session • Server

  21. Basic ASP Syntax <%@ Language=“JavaScript” %> <html> <head> <title>Hello, world</title> </head> <body> <% Response.Write(“Hello, world!”) %> </body> </html> Page directive Server tag delimiter ASP Object ASP Method

  22. The Response Object • Object used to send data to the client through the HTTP Response • Interesting methods: • Response.Write(“text to print in browser”) • Prints text in browser window • Response.Redirect(url) • Changes displayed in browser to the url argument. May be relative or absolute URL • Interesting properties: • Response.Expires = number • Amount of time in minutes that the page will be stored (and loaded from) the browser cache before it must be re-accessed from the server • Response.IsClientConnected • Stores a Boolean value indicating whether the client browser is communicating with server

  23. Request Object Object used to collect data from the client through the HTTP Request • Interesting collections: • Request.Form(“elementName”) • Extracts value from the elementName form element from forms that use the post method • Request.QueryString(“elementName”) • Extracts value from the elementName form element from forms that use the post method • Request.ServerVariables(“serverVariableName”) • Extracts value from the given server variable. Server variables include information like the clients browser type, IP address, HTTP header info, etc.

  24. Session Object • Contains data and settings for a user session – essentially, the time spent browsing through the website before exiting the browser window • Interesting property: • Session.SessionID • Stores a unique value for the current session generated by the server • Interesting technique • Create your own session variables via:Session(“variableName”) = value • All pages in the application will be able to access this variable

  25. The Server Object • Allows access to properties and methods only allowed on the server, like creating files and detecting file paths • Interesting methods: • MapPath(“filename”) – returns the file path (like C:\mopipi\debian\file1.htm) of the indicated file on the server • CreateObject(objectType) – creates a new instance of the indicated object type

  26. Free CGI Sites • The originals (Mostly Perl based) • eXtropia (http://www.extropia.com/) • Originally known as Selena Sol’s Scripts Archive • Founded as an offshoot from work done at the EFF • Electronic Frontier Foundation (http://www.eff.org/) • Currently in active development • Meta-Site Indexes for CGI • http://www.cgi-resources.com/

  27. Free Java Sites • The original • Gamelan (http://www.gamelan.com/) • Owned by EarthWeb, General Java Resource • Internet.com’s JavaBoutique (http://www.javaboutique.com/) • eXtropia - WebDB @ http://www.extropia.com/java/ • CoolServlets (http://www.coolservlets.com/) • Forum, Mailing List • JavaCorporate (http://www.javacorporate.com/) • Forum, Search engine (DB) • Meta-Directories • http://www.servletsource.com/software.jsp

  28. Free ASP Sites • Meta-Directories • ASP Resource Index (http://www.aspin.com/) • ASPCode (http://aspcode.com/) • Unlike Perl/Java, most free apps in ASP are sprinkled about • There isn’t really a single definitive resource

  29. Free PHP Sites • Meta-Site Indexes for PHP • PHP Resource Index (http://php.resourceindex.com/) • Sister site to the CGI Resource Index • PHP Wizard (http://www.phpwizard.net/) • PHP Developer (http://phpdeveloper.org/)

More Related