Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 4B: Server-Side Scripting IT 202—Internet Applications Based on notes developed by Morgan Benton.

Similar presentations


Presentation on theme: "Lecture 4B: Server-Side Scripting IT 202—Internet Applications Based on notes developed by Morgan Benton."— Presentation transcript:

1 Lecture 4B: Server-Side Scripting IT 202—Internet Applications Based on notes developed by Morgan Benton

2 For Today Intro to Server-side scripting Many flavors of “Hello, World!”

3 Review of Client/Server Model For networked applications, processing power is a valuable resource Most of the time both servers and clients possess processing power (i.e. they each have their own CPU) The decision has to be made about whether to run application logic on the client side, or the server side of the application

4 Reasons for Using Server-Side Scripting Some Application logic is complex and requires data from multiple sources Responsiveness is not a priority Greater security because the code gets hidden from the user Browser independence Access to file system on the server AND client

5 Which Scripting Environment? A variety exist including ASP, PHP, JSP, ColdFusion Web programmers tend to develop strong preferences for one or another, but all provide similar functionality The key question is where you will be hosting your application—the cost of the environment may be the deciding factor

6 A typical hosting environment Web Host Machine (aka a “server”) Web Application Application Server Web Server Operating System e.g. Amazon.com website PHP, ASP, JSP, ColdFusion, etc. Apache Web Server, IIS, etc. Linux, Windows, SunOS, etc. …to the Internet… also relies on other components not shown here, such as a database server, DBMS, etc. Dell, Gateway, etc.

7 Steps for writing server-side scripts 1. Get an account/directory on a server that hosts a scripting environment—at NJIT we have PHP, JSP, ASP, ColdFusion 2. Write pages that conform to the syntax and structure for that environment 3. Upload them to your server Hint: this is pretty much the same as for HTML except you need to be a little bit more careful about the directory where files are saved

8 Format for Server-Side Scripts Server-side scripts are text, just like the other languages we’ve studied this semester. Generally an (ASP, PHP,…) document looks just like HTML only it has some special opening and closing tags The most common opener/closer tags are

9 Many Flavors of ‘Hello! World’ The next pages will show a ‘Hello! World’ program in ASP, JSP, PHP, and ColdFusion

10 Active Server Pages—ASP Hello World! In ASP <% Response.write(“Hello World!”) %> The above is saved as hello_world.asp and uploaded to a Web server running an ASP environment like IIS.

11 Java Servelet Pages—JSP The above is saved as hello_world.jsp and uploaded to a Web server running a JSP environment like Tomcat.

12 PHP Hypertext Preprocessor Hello World! In PHP The above is saved as hello_world.php and uploaded to a Web server running a PHP environment like PHP for Apache.

13 ColdFusion Hello World! In CF #hw# The above is saved as hello_world.cfm and uploaded to a Web server running a CF environment like CF Server.

14 So which one should I use??? There are a number of factors: How much money do you have? What skillset do you have among your programmers? What other components (i.e. DBMS, platform) are you using? Where will the application be deployed?

15 About ASP Runs on IIS which is Microsoft and therefore only runs in Windows Defaults to VBScript, but also supports JavaScript Powerful, robust, supported Not free Limited availability at NJIT—see me

16 About JSP Runs on the Tomcat Server which anyone can download and run from either a Unix or Windows environtment Integrated with the Java programming language Powerful, robust, supported Free You can run Tomcat from your AFS account

17 About PHP Runs on PHP from either Unix or Windows environment Syntax and usage similar to C++/Java Powerful, robust, supported Free Already enabled for NJIT AFS accounts, or could be by e-mailing sys@oak.njit.edusys@oak.njit.edu

18 About ColdFusion Runs on ColdFusion server and more recently on major J2EE servers Uses proprietary, but powerful and “easy to learn” scripting language Very powerful, robust, supported Definitely not free Only 1 server that I know about at NJIT— see me for access

19 Let’s do it! Here’s an example of actually creating, uploading and testing a “hello world” page using PHP. The main thing to notice is what code gets output to your browser.


Download ppt "Lecture 4B: Server-Side Scripting IT 202—Internet Applications Based on notes developed by Morgan Benton."

Similar presentations


Ads by Google