Server-side Scripting
Slides courtesy of Xenia Mountrouidou
Server-side Scripting Slides courtesy of Xenia Mountrouidou URLs - - PowerPoint PPT Presentation
Server-side Scripting Slides courtesy of Xenia Mountrouidou URLs and web servers 2 http://server/path/file Usually when you type a URL in your browser: Your computer looks up the server's IP address using DNS Your browser connects
Slides courtesy of Xenia Mountrouidou
Usually when you type a URL in your browser:
Your computer looks up the server's IP address using
Your browser connects to that IP address and requests
The web server software (e.g. Apache) grabs that file
The server sends back its contents to you
2
3
Apache, Websphere (Java Servlets, XML Files)
Some URLs actually specify programs that the web
The above URL tells the server facebook.com to run the
4
By Lories Slockbower
A new style of programming language different from
Designed as glue language or system integration
A single statement can execute huge number of
Are normally ‘typeless’ Build complex algorithms and data structures.. Can create dynamic web pages
Change based on user input
Server-side Scripting Language Can use huge resources of the server Complete all processing in the server and send plain pages to the client Reduces client-side computation overhead Client-side Scripting Language Does not involve server processing Complete application is downloaded to the client browser Client browser executes it locally Are normally used to add functionality to web pages e.g. different menu
styles, graphic displays or dynamic advertisements
Active Server Pages (ASP) Server side scripting language Developed by Microsoft Good at connecting to Microsoft databases Runs only on Microsoft servers Perl Old UNIX language Found on all Windows and Linux servers Can handle text manipulation tasks Excellent web scripting language
PHP (Hypertext Pre-Processor) Especially good at connecting to MySQL Very popular language Runs on UNIX and Windows HTML-embedded scripting language Syntax looks like C, JAVA, and PERL Generate Dynamic content and good User Interface Server side execution JSP (Java Server Pages) Developed by Sun Uses Java Provide server-specific framework like Microsoft’s ASP
CGI (Common Gateway Interface) Server-side solution Needs to launch separate instance of application for each web request Allows direct interaction with users ASP.NET Server-side technology to create faster, reliable and dynamic web
pages
Supports .NET framework languages (C#, VB.NET, JScript.NET) Provides flexibility to designers and developers to work separately
VBScript Microsoft’s scripting language Client side Scripting language Very easy to learn Includes the functionality of Visual Basic JavaScript Client-side Scripting language Easy to use programming language Enhance dynamics and interactive features of a web page Allows to perform calculation, write interactive games, add special
effects, customize graphic selections, create security passwords
Scripting languages make the web development work Easier Faster Best utilization of resources It is the programmer’s choice which one will suite the
Knowledge Practice Resource
Server-side scripting is a
Server-side pages are programs written using one
examples: PHP
14
Customize a web page
Respond to queries
Access database and
User does not need to download
User can create one template for
The site can use a content
Generally quicker to load than
User is able to include external files
Scripts are hidden from view so it’s
The scripts can be used by
Scripting software must be
ASP source:
Output result
Hello world!
Client-side scripts are placed within an HTML document in the user’s web browser rather than the web server to allow greater interactivity in a
scripting could check the user’ s form for errors before submitting it
Enables web pages to change content according to user input and
separate file that is referenced to the documents that use it.
Usually, JavaScript code
Files are first sent to the
The client-side script may
Frequently, you can see
Suppose a person
This is JavaScript and is
Allows for more interactivity Can perform actions quickly
May be easier to use for
Are available from many free
If the user’s browser is out of date, the website will
More quality assurance testing is required because
Not secure because anyone can look at the code in
Some browsers will disable the active content and
JavaScript – Not to be
VBScript is a programming
Know your audience – Be sure to
Test scripts on the browsers for
Scripts should be tested on at
Simply defined, client-side code executes on the end-user's
Server-side code executes on the web server, usually within a
Which one to choose? What are the determining factors? Performance:
Responsiveness, speed, reliability Ability to handle a large number of simultaneous users Functionality: Simplicity of use and maintenance, Breadth of user options Ability to handle multiple simultaneous transactions Security: Desktop security Server security Database security Network security
Examples:
Code that runs on the server that interprets every
terminal to mainframe paradigm
On the other hand, one does not want to download an
Server side forms have direct access to active code and
On the other hand they are more prone to slowdowns
In general, the key areas where client-side coding has advantages stem
from its location on the user desktop and/or other end device. They include the following:
Interactivity (e.g., mouse and keyboard handling) Handling of user interface controls: buttons, textboxes, etc. Feedback and validation
Key server-side strengths include stem from their proximity to the backend
business databases and other applications. They include the following:
Direct information access, retrieval, processing and storage
facilitate e-commerce, reservations, shipment tracking etc.
central repository of added web features such as e-mail, chat and multimedia
streaming
security and authentication (mostly)
EPL344
30
PHP stands for "PHP Hypertext Preprocessor" Server-side scripting language Used to make web pages dynamic:
provide different content depending on context interface with other services: database, e-mail, etc. authenticate users process form information
PHP code can be embedded
31
32
Hello world!
User’s computer Server computer Hello.php
Free and open source Compatible Simple
33
34
<?php print "Hello, world!"; ?> PHP
Hello world!
35
Hello world!
36
Contents of a .php file between <?php and ?> are executed
All other contents are output as pure HTML We can switch back and forth between HTML and PHP
HTML content <?php PHP code ?> HTML content <?php PHP code ?> HTML content ...
PHP C:\Users\SCRAT\Dropbox\Belk\UCY Teaching\EPL344