1 / 10

Server Side Scripting

Server Side Scripting. Norman White. Where do we do processing?. Client side Javascript (embed code in html) Java applets (send java program to run under the browser) Server side CGI program Send form information to a program running on a server.

ida
Download Presentation

Server Side Scripting

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. Server Side Scripting Norman White

  2. Where do we do processing? • Client side • Javascript (embed code in html) • Java applets (send java program to run under the browser) • Server side • CGI program • Send form information to a program running on a server. • Server CGI program sends results back as HTML (or some other browser supported format) • Popular CGI languages are perl, python, java, C, C++, … • HTML with embedded code (Server side scripts) • PhP, ASP, Cold Fusion, JSP (Java Server Pages), javascript • In this case, the embedded code is executed as the web server sends the page out, not when the web browser goes to display the page.

  3. Advantages of Server Side Scriptingover CGI • No need to have CGI program generate the HTML. • HTML automatically sent to the browser • Developer only needs to add code for server side processing like data base access etc. • Much less code to write, easier to debug, etc. • 3 Common environments, PHP, ASP, JSP • PHP uses a C syntax • ASP (Active Server Pages) is visual basic • JSP (Java Server Pages) is Java syntax • Can also do server side javascript

  4. Embedded Scripts (Scriptlets) • Scripting statements are enclosed in script tags. • PhP <?php statements … ?> • <html>< body>< ?php$d=date("D");if ($d=="Fri") echo "Have a nice weekend!";?>< /body>< /html> • ASP, JSP • <%statements ….. %> • ASP uses Visual Basic for Scripting,

  5. ASP Example • Static Page

  6. Dynamic Page • Page is generated by ASP engine which executes scriptlet statements as they are encountered.

  7. PhP Examples <HTML> <HEAD> <TITLE> Hello World in PHP </TITLE> </HEAD> <BODY> <? // Hello world in PHP print("Hello World"); ?> </BODY> </HTML>

  8. How do we tell server that we have server side scripting? • Name the file .php, .asp, .jsp, .cfm • Note, the web server has to be configured to invoke the correct script interpreter. • Not all web servers support all scripting languages. • Microsoft supports ASP, can add PhP • Apache supports Php • Tomcat (a java based server) supports JSP.

  9. Who does what where? • As a test of your understanding, how could you answer the following question. • Assuming the user and the web server are in the same time zone, and have synchronized time, how long (milliseconds) does it take to download a simple web page? • Could you create a web page that answers this question using PHP? • How hard is it? • What do you need to know?

  10. Team question • In 5 minutes, sketch an answer to the previous question.

More Related