150 likes | 288 Views
Languages for Dynamic Web Documents. presented by Francisco A. Rojas. What is a dynamic web document?. One or more of the following:
E N D
Languages for Dynamic Web Documents presented by Francisco A. Rojas
What is a dynamic web document? One or more of the following: • A web document with information that is not static or not hard-coded by the webmaster (a document that is dynamically generated by the server in response to a query) • Something on the web page moves or changes (animated) • The web page may respond to user input • It is DHTML!!! — A combination of HTML, style sheets and scripts that allows documents to be animated
“DHTML combines HTML 4, the DOM, scripting and CSS to create dynamic, interactive pages not possible with static HTML or paper-based documents.” Common examples of DHTML: Rollovers: Information changes in response to user actions. Show/Hide: Information appears (shows) or disappears (hides) in response to user actions. Animation: Information moves about the page, automatically or in response to user actions. Source: http://www.xhtmlchef.com/forehelp_08-01.asp Rollover Image: Show / Hide Animation DHTML – Dynamic HTML
Client-side DHTML is usually processed on this side for fastest execution on local machine memory. Good for DHTML that does not involve the Server and helps relieve the burden on doing the same task on Servers. Often form input error checking is handled here before information is passed on to the server. Languages: ECMAScript (JavaScript, JScript), VBScript Server-side Server-side DHTML effects such as personalization and session configurations are processed here. Often a database is being used to retrieve information to be displayed in a dynamically generated webpage that is produced by the server and sent to the client for presentation. Languages: ASP, JSP Two Sides to DHTML
Client-Side DHTML Most commonly used language for client-side DHTML is JavaScript. Demo: Making your tables sortable. http://www.kryogenix.org/code/browser/sorttable/
Server-Side DHTML Concept Server-Side DHTML usually involves the server creating a dynamically generated web page that is data driven. The html page is a result of a server side script that generates the html. This page is dynamically generated at the client’s request, thus getting unique html page results based on the queries submitted. Having a static webpage for every possible query is not practical, especially if the data in the database changes! Server (Web server) URL request Database Client (Browser) html page html Table
Basic Sequence of Data Driven Web Pages • User clicks on a JSP, ASP, or ASP .NET file link • Client requests this file from server • Server executes this file • This file generates the html page using the database data • The server sends this new html page to client • The client displays this html page
Active Server Pages (ASP) Two styles of ASP: 1) Old style ASP scriptlets Look like this: 2) ASP .NET There is a separation of html and code, but you still have the option of using ASP scriptlets. The separate code can be C#, Visual Basic .NET, or any other programming language. ASP is a program that runs inside Internet Information Systems (IIS), and it is a Microsoft Technology An ASP file (extension .asp) is html with embedded server scripts ASP .NET file extension is .aspx ASP is shipped with VBScript and JScript (Microsoft's implementation of JavaScript). If you want to script in another language, like PERL, REXX, or Python, you will have to install script engines for them. Also, because the scripts are executed on the server, the browser that displays the ASP file does not need to support scripting at all! ASP & ASP .NET
ASP: HTML + Script Server-script tags: <% code %> <%= expression %> • Tag contents are executed and replaced with script’s output script.asp: <%@ Page language="c#” %> <html><body> The time is <%= System.Date.Now.ToString() %> <% if(System.Date.Now < “12:00pm”){ %> <p>Good morning <% }else{ %> <p>Good afternoon <% } %> </body></html> • Client receives: <html><body> The time is 2:03pm <p>Good afternoon </body></html> This is why if the user tries to View Source in web browser, you do not see any of the asp source code because it got replaced with html and text. At page request, Server executes script <%= expr %> Replaced with value of expr <% code %> Executes code
ASP .NET: Use Separate Code .aspx = html with asp tags, .aspx.cs = associated C# code Also supports old ASP-style embedded code Must use Microsoft Visual Studio .NET. This is useful in creating web based applications, and what gets constructed in the forms automatically appears in code form in the source files. Much code is automated and helps with writing the asp .net tags.
JSP and Servlets, WSAD JSP (Java Server Pages) is just like ASP, but it only supports Java in the scriptlets and the separate source files called Servlets (same general idea as ASP .NET). It also has its own tag libraries. WebSphere Studio Application Developer, developed by IBM, is a tool specifically designed for producing web applications, but it is much more of a challenge to learn and use compared to MS Visual Studio .NET.
Successful Deployment of Web Application Demo http://albatross.cslab.vt.edu/vtdiet/ WSAD made web application UserName: FrancisDemo Password: chessmaster