Web forms and Server Side Scripting Server Side Scripting
Internet Development Applications Sawsan Slii Marzouki Internet Applicatiosn Development
Dynamic Interactive Web Server What is a server? (3-tier architecture)
Many types of server: File server FTP server Web server Mail server News server
General Multi-tier Architecture Web content
HTML documents are static Dynamic content : User side programming (JavaScript, CSS, Ajax, JQuery …… ) Server side programming (PHP, ASP and ASP.Net, JSP, Python ….)
1 Why Server Side Programming? History of web dynamic content
Accessibility : Common Gateway Interface (CGI) was the Any one can reach Internet. first generation approach to providing dynamic web content (used scripts) Manageability : Does not require distribution of application code Numerous second generation alternatives were invented (FastCGI, mod_Perl, NSAPI, Security : ISAPI, Java Servlets …) Source code is not exposed Scripting, the third generation ( طور ) : Scalability Web-based 3-tier architecture can scale out approach
Scripting, the third generation approach Scripting languages or compiled
Embed simple code in HTML pages Scripting languages Compiled languages The HTML pages use the code to decide what elements to display and what data should be Server Side Includes (SSI) C displayed. Perl C++ PHP ASP.Net Classes and/or subroutines can be called to compute information for inclusion in the web ASP (VBScript) Java Servlet page. Python Java Server Pages This is know as « scripting ».
Some approaches to Scripting Criteria affecting Scripting choice
JavaServer Pages ( JSP ) by Sun MicroSystems Web Server availability
Hypertext Preprocessor (PHP ): open source Knowledge of language
Cold Fusion (CFML) by Macromedia Scalability and efficiency
Active Server Pages ( ASP and ASP.Net ) by MicroSoft Personal preference
2 JSP (Java Server Pages) Learn more about JSP, Java-based technology that simplifies the development of dynamic websites PHP and ASP.Net Designed around the Java Philosophy Packaged with J2EE It separates presentation aspects from programming logic contained in the code.
J2EE Technology Servlets and JSP
Web container (application server) EJB container Servlets : JSP pages running in webServers JSP: JavaServer Pages Apples, XML, JDBC, …… .
JSP Basics A simple JSP code
Individual JSP pages are text files stored on the web server. When a page is first required, then JSP Engine uses the page to generate a Servlet. The compiled Servlet is saved and used to serve additional requests. When a page is modified, the appropriate Servlet is New.java.util.Date().ToString(): creates a date regenerated. Object and converts it to a String that can be displayed Precompilation is also possible
3 What is PHP? What is PHP?
Open source Server-Side Scripting language Commands are preprocessed by Php designed specifically for the web. processor and appropriate HTML is sent to Conceived in 1994. the web server. Supports a wide-range of databases. Platoform independant Perl and C like syntax. Easy to learn Designed similar to ASP: you embed Usually associated to MySQL database (a commands into your web pages. relational free DBMS, can run on Unix, Windows, and Mac OS).
Php Process Flow Php first example:
ASP.Net Based on .Net Framework and the common web forms and Server language runtime (CLR) Compiled language Side Scripting MicroSoft Only Platforms
4 Form processing script Steps to Form Processing Script
Creating the HTML code for the form
The “action ” specifies what page to submit the form to. The “method ” indicates how the form is submitted :Get and Post. Most of the time, forms will use the “post ” method.Steps to Form Processing Script Steps to Form Processing Script