SlideShare ist ein Scribd-Unternehmen logo
1 von 33
Client side and Server side 
Scripting 
Razi Kallayi 
RaziKallayi@gmail.com 
www.facebook.com/RaziKallayi 
twitter.com/RaziKallayi 
in.linkedin.com/in/RaziKallayi 
9746730324 
Typing Speed :26 wpm
Disclaimer: This presentation is prepared by trainees of 
baabtra as a part of mentoring program. This is not official 
document of baabtra –Mentoring Partner 
Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
Scripting Languages 
• A scripting language is a programming language that supports the writing of 
scripts 
• A single script statement can execute huge number of machine instructions 
• Designed as glue language or system integration language 
• Are normally ‘typeless’ 
• Can create dynamic web page 
• Change based on user input
Features 
Ease of use: 
scripting languages are intended to be very fast to pick up 
Interpreted from source code: 
to give the fastest turnaround between the scripting phase and the 
execution phase
Types of Scripting Languages 
Server-side Scripting Language 
Client-side Scripting Language
Client-side Scripting 
• Client side scripting is used when the users browser already has all the code and the 
page is altered on the basis of the users input. 
• The Web Browser executes the client side scripting that resides at the user’s 
computer. 
• 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
Client-side Scripting [contd.] 
• The browser receives the page sent by the server and executes 
the client-side scripts. 
• Client side scripting cannot be used to connect to the databases 
on the web server. 
• Client side scripting can’t access the file system that resides at 
the web server.
Client-side Scripting [contd.] 
• The files and settings that are local at the user’s computer can be 
accessed using Client side scripting. 
• Response from a client-side script is faster as compared to a server-side 
script because the scripts are processed on the local computer. 
• Examples of Client side scripting languages : Javascript, VB script, etc.
What can JavaScript do? 
• Control document appearance and content 
• Control the browser 
• Interact with the user 
• Read and Write Client State with Cookies 
– my.yahoo.com 
• Interact with Applets 
– Read/write files
List of Client-Side Scripting Languages 
• JavaScript 
• ActionScript 
• Dart 
• VBScript 
• Typescript
Example for Client side scripting in JavaScript 
<html> 
<head> 
<script> 
function add(){ 
var a=parseInt(document.getElementById("firstNumber").value); 
var b=parseInt(document.getElementById("secondNumber").value); 
var sum=a+b; 
document.getElementById("lblSum").innerHTML=sum; 
} 
</script> 
</head> 
<body> 
<form> 
<table align="center" border="1px" > 
<tr><td> 
<table align="center" > 
<tr> 
<td>First Number:</td> 
<td><input id="firstNumber" type="text" ></td> 
</tr> 
<tr> 
<td>Second Number:</td> 
<td><input id="secondNumber" type="text" ></td> 
<td><input id="secondNumber" type="button" value="add" onClick= "add()"> 
</td> 
</tr> 
<tr> 
<td><label>Sum= </label></td> 
<td><label id="lblSum"> </label></td> 
</tr></table> 
</tr></td></table> 
</form> 
</body> 
</html> 
Java script inside an html 
page
Server-side scripting
How does it work?
Server-side scripting 
• 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 
• The server is where the Web page and other content lives. 
• The server sends pages to the user/client on request. 
• Server-side scripting is about "programming" the behavior of the server.
Server-side scripting [contd.] 
• used to connect to the databases that reside on the web server. 
• can access the file system residing at the web server. 
• Response from a server-side script is slower as compared to a client-side 
script because the scripts are processed on the remote computer. 
• The Web Server executes the server side scripting that produces the 
page to be sent to the browser. 
• Server executes server-side scripts to send out a page but it does not 
execute client-side scripts.
Advantages 
• Interpreted, low processing overhead 
• Interpreter is integrated into web server, so it is fast 
• Secure, code runs on server 
• Content based on live data 
• Can use basic devices, eg phone, browsers as processing is server side 
• does not require the user to download plug-in like Java or Flash (as in 
client-side scripting). 
• Load times are generally faster than client-side scripting. 
• Your scripts are hidden from view.
Disadvantages 
• Debugging tools can be scarce 
• Can be more difficult to develop 
• Requires a running server to test 
• Has no direct control over the user interface
What can server scripts do? 
• Dynamically edit,change or add any content to a web page. 
• Responds to user queries or data submitted from html forms. 
• Access any data or databases & return the result to a browser. 
• Customize a web page to make it more useful for individual users. 
• Provide security since your server code cannot be viewed from a browser.
Scripting languages with extension 
- ASP (*.asp) 
- ASP.NET (*.aspx) 
- C via CGI (*.c, *.csp) 
- ColdFusion Markup Language (*.cfm) 
- Java via JavaServer Pages (*.jsp) 
- JavaScript using Server-side JavaScript (*.ssjs, *.js) 
- Lua (*.lp *.op) 
- Perl CGI (*.cgi, *.ipl, *.pl) 
- PHP (*.php) - Open Source Scripting 
- Python, e.g. via Django (*.py) 
- Ruby, e.g. Ruby on Rails (*.rb, *.rbw) 
- SMX (*.smx) 
- Lasso (*.lasso) 
- WebDNA (*.dna,*.tpl) 
- Progress WebSpeed (*.r,*.w)
PHP 
Personal Home Page / Hypertext Pre-Processor 
• Widely-used scripting language 
• PHP is free software released 
• PHP code can be embedded into HTML or XHTML documents 
• It is executed on the server to generate dynamic web content. 
• PHP is frequently used together with MySQL
Example for PHP 
<html> 
<head> 
<title>Today&rsquo;s Date</title> 
</head> 
<body> 
<p><h1>Today&rsquo;s date (according to 
this web server) is <br> 
<?php 
echo date('d - m - Y, l '); 
?> 
</h1> 
</p> 
</body> 
</html> 
<?PHP is the opening tag 
(?> is the closing tag) 
Using the PHP date function to get the date set 
on the server and echo it to the screen
<html> 
<head> 
<title>Today&rsquo;s Date</title> 
</head> 
<body> 
<p><h1>Today&rsquo;s date (according 
to this web server) is <br> 
28 - 08 - 2014, Thursday 
</h1> 
</p> 
</body> 
</html> 
Browser displays: 
Source is:
Java Server Pages (JSP) 
• A Java technology similar to ASP 
• Used to create dynamically generated web pages by embedding Java 
programming code in HTML or XHTML documents 
• A Java Server Page is compiled into a Java servlet by an application server, 
rather than being interpreted 
• a servlet is a Java program that executes on the server to create dynamic 
web pages.
• You can sometimes tell which scripting language a website is 
using by looking at the address bar. 
• Text after a question mark in an address is parameter s and 
variables send to the script.
An example for JSP 
Source 
<html> 
<head> 
<title>User Profile</title> 
</head> 
<body> 
<h1>User Profile</h1> 
<table> 
<tr><td>User Name: </td><td>razi</td></tr> 
<tr><td>Email: 
</td><td>razi@kallayi.com</td></tr> 
<tr><td>Gender: </td><td>Male</td></tr> 
<tr><td>Age: </td><td>22</td></tr> 
</table> 
</body> 
</html>
<% @page import="com.baabtra.Service.ProfileService"%> 
<%@page import="com.baabtra.Service.LoginService"%> 
<%@page import="com.baabtra.Bean.RegistrationBean"%> 
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" 
pageEncoding="ISO-8859-1“ %> 
<html> <head><title>User Profile</title></head><body> 
<% 
Integer ses_id=(Integer)session.getAttribute("login_id"); //here Integer is an object. int is converted to 
Integer object 
RegistrationBean objRegistrationBean = new RegistrationBean(); 
ProfileService objProfileService= new ProfileService(); 
objRegistrationBean = objProfileService.profileService(ses_id.intValue());//convert integer object back to int 
primitive data type 
String strUsername =objRegistrationBean.getStrUsername(); 
%> 
<h1>User Profile</h1> 
<table> 
<tr><td>User Name: </td><td><%=objRegistrationBean.getStrUsername()%></td></tr> 
<tr><td>Email: </td><td><%=objRegistrationBean.getStrEmail()%></td></tr> 
<tr><td>Gender: </td><td><%=objRegistrationBean.getStrGender()%></td></tr> 
<tr><td>Age: </td><td><%=objRegistrationBean.getStrDob()%></td></tr> 
</table></body> </html> 
Html page 
Scriplets 
Imports
public RegistrationBean viewProfileDb(int loginId){ 
ConnectionDb objConn= new ConnectionDb(); 
Connection con=objConn.con; 
Statement st=(Statement)con.createStatement(); 
String sql="select vchr_username, vchr_email, vchr_gender, 
timestampdiff(year,dat_dob,current_date) as age from 
tbl_login join tbl_user on pk_int_loginid=fk_int_loginid 
where pk_int_loginid="+loginId+";"; 
ResultSet rs= st.executeQuery(sql); 
RegistrationBean user = new RegistrationBean(); 
/*Get data from db and set it to a bean object*/ 
while(rs.next()){ 
user.setStrUsername(rs.getString("vchr_username")); 
user.setStrEmail(rs.getString("vchr_email")); 
user.setStrGender(rs.getString("vchr_gender")); 
user.setStrDob(rs.getString("age")); 
} 
return user; 
} 
Fetching Data from 
database 
for the specified user
The Combination 
Sites like Google, Amazon, Facebook etc. use both types of scripting: 
• server-side handles logging in, personal information and preferences and provides the 
specific data which the user wants (and allows new data to be stored) 
• client-side makes the page interactive, displaying or sorting data. 
• Can build efficient applications 
• Choice to do the processing in the most appropriate location 
• Choice where to keep up to date multi use data 
• Choose how to optimise the user experience: 
– Performance 
– Appearance 
– Function
tyhoanuk 
RAZI KALLAYI
Want to learn more about programming or Looking to become a good programmer? 
Are you wasting time on searching so many contents online? 
Do you want to learn things quickly? 
Tired of spending huge amount of money to become a Software professional? 
Do an online course 
@ baabtra.com 
We put industry standards to practice. Our structured, activity based courses are so designed 
to make a quick, good software professional out of anybody who holds a passion for coding.
Follow us @ twitter.com/baabtra 
Like us @ facebook.com/baabtra 
Subscribe to us @ youtube.com/baabtra 
Become a follower @ slideshare.net/BaabtraMentoringPartner 
Connect to us @ in.linkedin.com/in/baabtra 
Give a feedback @ massbaab.com/baabtra 
Thanks in advance 
www.baabtra.com | www.massbaab.com |www.baabte.com
Contact Us 
Emarald Mall (Big Bazar Building) 
Mavoor Road, Kozhikode, 
Kerala, India. 
Ph: + 91 – 495 40 25 550 
NC Complex, Near Bus Stand 
Mukkam, Kozhikode, 
Kerala, India. 
Ph: + 91 – 495 40 25 550 
Cafit Square, 
Hilite Business Park, 
Near Pantheerankavu, 
Kozhikode 
Start up Village 
Eranakulam, 
Kerala, India. 
Email: info@baabtra.com

Weitere ähnliche Inhalte

Was ist angesagt?

Introduction to web development
Introduction to web developmentIntroduction to web development
Introduction to web development
Mohammed Safwat
 
Html text and formatting
Html text and formattingHtml text and formatting
Html text and formatting
eShikshak
 
Web Design Notes
Web Design NotesWeb Design Notes
Web Design Notes
butest
 

Was ist angesagt? (20)

Dynamic HTML (DHTML)
Dynamic HTML (DHTML)Dynamic HTML (DHTML)
Dynamic HTML (DHTML)
 
Introduction to Html5
Introduction to Html5Introduction to Html5
Introduction to Html5
 
Server side scripting
Server side scriptingServer side scripting
Server side scripting
 
Dynamic Web
Dynamic WebDynamic Web
Dynamic Web
 
Web Application Introduction
Web Application  IntroductionWeb Application  Introduction
Web Application Introduction
 
Introduction to web development
Introduction to web developmentIntroduction to web development
Introduction to web development
 
Html text and formatting
Html text and formattingHtml text and formatting
Html text and formatting
 
Introduction to asp.net
Introduction to asp.netIntroduction to asp.net
Introduction to asp.net
 
IIS
IISIIS
IIS
 
Apache web server
Apache web serverApache web server
Apache web server
 
Web Design Notes
Web Design NotesWeb Design Notes
Web Design Notes
 
Lecture 1 intro to web designing
Lecture 1  intro to web designingLecture 1  intro to web designing
Lecture 1 intro to web designing
 
Lecture-3: Introduction to html - Basic Structure & Block Building
Lecture-3: Introduction to html - Basic Structure & Block BuildingLecture-3: Introduction to html - Basic Structure & Block Building
Lecture-3: Introduction to html - Basic Structure & Block Building
 
Elements Of Web Design
Elements Of Web DesignElements Of Web Design
Elements Of Web Design
 
Bootstrap
BootstrapBootstrap
Bootstrap
 
php
phpphp
php
 
Difference between-web-designing-and-web-development
Difference between-web-designing-and-web-developmentDifference between-web-designing-and-web-development
Difference between-web-designing-and-web-development
 
Ide description
Ide descriptionIde description
Ide description
 
Software testing ppt
Software testing pptSoftware testing ppt
Software testing ppt
 
Html ppt
Html pptHtml ppt
Html ppt
 

Ähnlich wie Client and server side scripting

web-servers3952 (1)qwjelkjqwlkjkqlwe.ppt
web-servers3952 (1)qwjelkjqwlkjkqlwe.pptweb-servers3952 (1)qwjelkjqwlkjkqlwe.ppt
web-servers3952 (1)qwjelkjqwlkjkqlwe.ppt
20521742
 

Ähnlich wie Client and server side scripting (20)

Web Database
Web DatabaseWeb Database
Web Database
 
JS BASICS JAVA SCRIPT SCRIPTING
JS BASICS JAVA SCRIPT SCRIPTINGJS BASICS JAVA SCRIPT SCRIPTING
JS BASICS JAVA SCRIPT SCRIPTING
 
01 - Web Programming Intro.pptx
01 - Web Programming Intro.pptx01 - Web Programming Intro.pptx
01 - Web Programming Intro.pptx
 
DYNAMIC CONTENT TECHNOLOGIES ASP(ACTIVE SERVER PAGES)
DYNAMIC CONTENT TECHNOLOGIES ASP(ACTIVE SERVER PAGES)DYNAMIC CONTENT TECHNOLOGIES ASP(ACTIVE SERVER PAGES)
DYNAMIC CONTENT TECHNOLOGIES ASP(ACTIVE SERVER PAGES)
 
Client&server side scripting
Client&server side scriptingClient&server side scripting
Client&server side scripting
 
web-servers3952 (1)qwjelkjqwlkjkqlwe.ppt
web-servers3952 (1)qwjelkjqwlkjkqlwe.pptweb-servers3952 (1)qwjelkjqwlkjkqlwe.ppt
web-servers3952 (1)qwjelkjqwlkjkqlwe.ppt
 
INDUSTRIAL TRAINING Presentation on Web Development. (2).pptx
INDUSTRIAL TRAINING Presentation on Web Development. (2).pptxINDUSTRIAL TRAINING Presentation on Web Development. (2).pptx
INDUSTRIAL TRAINING Presentation on Web Development. (2).pptx
 
Week one presentation principles of web server scripting
Week one presentation   principles of web server scriptingWeek one presentation   principles of web server scripting
Week one presentation principles of web server scripting
 
Client & server side scripting
Client & server side scriptingClient & server side scripting
Client & server side scripting
 
Client Side scripting and server side scripting
Client Side scripting and server side scriptingClient Side scripting and server side scripting
Client Side scripting and server side scripting
 
Websites Unlimited - Pay Monthly Websites
Websites Unlimited - Pay Monthly WebsitesWebsites Unlimited - Pay Monthly Websites
Websites Unlimited - Pay Monthly Websites
 
Introduction to Jquery
Introduction to JqueryIntroduction to Jquery
Introduction to Jquery
 
Les Basiques - Web Développement HTML5, CSS3, JS et PHP
Les Basiques - Web  Développement HTML5, CSS3, JS et PHPLes Basiques - Web  Développement HTML5, CSS3, JS et PHP
Les Basiques - Web Développement HTML5, CSS3, JS et PHP
 
ATO- Intro to Web Concepts
ATO- Intro to Web ConceptsATO- Intro to Web Concepts
ATO- Intro to Web Concepts
 
HTML 5
HTML 5HTML 5
HTML 5
 
Ch 10: Hacking Web Servers
Ch 10: Hacking Web ServersCh 10: Hacking Web Servers
Ch 10: Hacking Web Servers
 
CHAPTER 3 JS (1).pptx
CHAPTER 3  JS (1).pptxCHAPTER 3  JS (1).pptx
CHAPTER 3 JS (1).pptx
 
BITM3730Week12.pptx
BITM3730Week12.pptxBITM3730Week12.pptx
BITM3730Week12.pptx
 
Making Of PHP Based Web Application
Making Of PHP Based Web ApplicationMaking Of PHP Based Web Application
Making Of PHP Based Web Application
 
Server and Client side comparision
Server and Client side comparisionServer and Client side comparision
Server and Client side comparision
 

Mehr von baabtra.com - No. 1 supplier of quality freshers

Mehr von baabtra.com - No. 1 supplier of quality freshers (20)

Agile methodology and scrum development
Agile methodology and scrum developmentAgile methodology and scrum development
Agile methodology and scrum development
 
Best coding practices
Best coding practicesBest coding practices
Best coding practices
 
Core java - baabtra
Core java - baabtraCore java - baabtra
Core java - baabtra
 
Acquiring new skills what you should know
Acquiring new skills   what you should knowAcquiring new skills   what you should know
Acquiring new skills what you should know
 
Baabtra.com programming at school
Baabtra.com programming at schoolBaabtra.com programming at school
Baabtra.com programming at school
 
99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love 99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love
 
Php sessions & cookies
Php sessions & cookiesPhp sessions & cookies
Php sessions & cookies
 
Php database connectivity
Php database connectivityPhp database connectivity
Php database connectivity
 
Chapter 6 database normalisation
Chapter 6  database normalisationChapter 6  database normalisation
Chapter 6 database normalisation
 
Chapter 5 transactions and dcl statements
Chapter 5  transactions and dcl statementsChapter 5  transactions and dcl statements
Chapter 5 transactions and dcl statements
 
Chapter 4 functions, views, indexing
Chapter 4  functions, views, indexingChapter 4  functions, views, indexing
Chapter 4 functions, views, indexing
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
Chapter 3 stored procedures
 
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2  grouping,scalar and aggergate functions,joins   inner join,outer joinChapter 2  grouping,scalar and aggergate functions,joins   inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Microsoft holo lens
Microsoft holo lensMicrosoft holo lens
Microsoft holo lens
 
Blue brain
Blue brainBlue brain
Blue brain
 
5g
5g5g
5g
 
Aptitude skills baabtra
Aptitude skills baabtraAptitude skills baabtra
Aptitude skills baabtra
 
Gd baabtra
Gd baabtraGd baabtra
Gd baabtra
 

Kürzlich hochgeladen

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Kürzlich hochgeladen (20)

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

Client and server side scripting

  • 1.
  • 2. Client side and Server side Scripting Razi Kallayi RaziKallayi@gmail.com www.facebook.com/RaziKallayi twitter.com/RaziKallayi in.linkedin.com/in/RaziKallayi 9746730324 Typing Speed :26 wpm
  • 3. Disclaimer: This presentation is prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring Partner Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
  • 4. Scripting Languages • A scripting language is a programming language that supports the writing of scripts • A single script statement can execute huge number of machine instructions • Designed as glue language or system integration language • Are normally ‘typeless’ • Can create dynamic web page • Change based on user input
  • 5. Features Ease of use: scripting languages are intended to be very fast to pick up Interpreted from source code: to give the fastest turnaround between the scripting phase and the execution phase
  • 6. Types of Scripting Languages Server-side Scripting Language Client-side Scripting Language
  • 7. Client-side Scripting • Client side scripting is used when the users browser already has all the code and the page is altered on the basis of the users input. • The Web Browser executes the client side scripting that resides at the user’s computer. • 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
  • 8. Client-side Scripting [contd.] • The browser receives the page sent by the server and executes the client-side scripts. • Client side scripting cannot be used to connect to the databases on the web server. • Client side scripting can’t access the file system that resides at the web server.
  • 9. Client-side Scripting [contd.] • The files and settings that are local at the user’s computer can be accessed using Client side scripting. • Response from a client-side script is faster as compared to a server-side script because the scripts are processed on the local computer. • Examples of Client side scripting languages : Javascript, VB script, etc.
  • 10. What can JavaScript do? • Control document appearance and content • Control the browser • Interact with the user • Read and Write Client State with Cookies – my.yahoo.com • Interact with Applets – Read/write files
  • 11. List of Client-Side Scripting Languages • JavaScript • ActionScript • Dart • VBScript • Typescript
  • 12. Example for Client side scripting in JavaScript <html> <head> <script> function add(){ var a=parseInt(document.getElementById("firstNumber").value); var b=parseInt(document.getElementById("secondNumber").value); var sum=a+b; document.getElementById("lblSum").innerHTML=sum; } </script> </head> <body> <form> <table align="center" border="1px" > <tr><td> <table align="center" > <tr> <td>First Number:</td> <td><input id="firstNumber" type="text" ></td> </tr> <tr> <td>Second Number:</td> <td><input id="secondNumber" type="text" ></td> <td><input id="secondNumber" type="button" value="add" onClick= "add()"> </td> </tr> <tr> <td><label>Sum= </label></td> <td><label id="lblSum"> </label></td> </tr></table> </tr></td></table> </form> </body> </html> Java script inside an html page
  • 14. How does it work?
  • 15. Server-side scripting • 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 • The server is where the Web page and other content lives. • The server sends pages to the user/client on request. • Server-side scripting is about "programming" the behavior of the server.
  • 16. Server-side scripting [contd.] • used to connect to the databases that reside on the web server. • can access the file system residing at the web server. • Response from a server-side script is slower as compared to a client-side script because the scripts are processed on the remote computer. • The Web Server executes the server side scripting that produces the page to be sent to the browser. • Server executes server-side scripts to send out a page but it does not execute client-side scripts.
  • 17. Advantages • Interpreted, low processing overhead • Interpreter is integrated into web server, so it is fast • Secure, code runs on server • Content based on live data • Can use basic devices, eg phone, browsers as processing is server side • does not require the user to download plug-in like Java or Flash (as in client-side scripting). • Load times are generally faster than client-side scripting. • Your scripts are hidden from view.
  • 18. Disadvantages • Debugging tools can be scarce • Can be more difficult to develop • Requires a running server to test • Has no direct control over the user interface
  • 19. What can server scripts do? • Dynamically edit,change or add any content to a web page. • Responds to user queries or data submitted from html forms. • Access any data or databases & return the result to a browser. • Customize a web page to make it more useful for individual users. • Provide security since your server code cannot be viewed from a browser.
  • 20. Scripting languages with extension - ASP (*.asp) - ASP.NET (*.aspx) - C via CGI (*.c, *.csp) - ColdFusion Markup Language (*.cfm) - Java via JavaServer Pages (*.jsp) - JavaScript using Server-side JavaScript (*.ssjs, *.js) - Lua (*.lp *.op) - Perl CGI (*.cgi, *.ipl, *.pl) - PHP (*.php) - Open Source Scripting - Python, e.g. via Django (*.py) - Ruby, e.g. Ruby on Rails (*.rb, *.rbw) - SMX (*.smx) - Lasso (*.lasso) - WebDNA (*.dna,*.tpl) - Progress WebSpeed (*.r,*.w)
  • 21. PHP Personal Home Page / Hypertext Pre-Processor • Widely-used scripting language • PHP is free software released • PHP code can be embedded into HTML or XHTML documents • It is executed on the server to generate dynamic web content. • PHP is frequently used together with MySQL
  • 22. Example for PHP <html> <head> <title>Today&rsquo;s Date</title> </head> <body> <p><h1>Today&rsquo;s date (according to this web server) is <br> <?php echo date('d - m - Y, l '); ?> </h1> </p> </body> </html> <?PHP is the opening tag (?> is the closing tag) Using the PHP date function to get the date set on the server and echo it to the screen
  • 23. <html> <head> <title>Today&rsquo;s Date</title> </head> <body> <p><h1>Today&rsquo;s date (according to this web server) is <br> 28 - 08 - 2014, Thursday </h1> </p> </body> </html> Browser displays: Source is:
  • 24. Java Server Pages (JSP) • A Java technology similar to ASP • Used to create dynamically generated web pages by embedding Java programming code in HTML or XHTML documents • A Java Server Page is compiled into a Java servlet by an application server, rather than being interpreted • a servlet is a Java program that executes on the server to create dynamic web pages.
  • 25. • You can sometimes tell which scripting language a website is using by looking at the address bar. • Text after a question mark in an address is parameter s and variables send to the script.
  • 26. An example for JSP Source <html> <head> <title>User Profile</title> </head> <body> <h1>User Profile</h1> <table> <tr><td>User Name: </td><td>razi</td></tr> <tr><td>Email: </td><td>razi@kallayi.com</td></tr> <tr><td>Gender: </td><td>Male</td></tr> <tr><td>Age: </td><td>22</td></tr> </table> </body> </html>
  • 27. <% @page import="com.baabtra.Service.ProfileService"%> <%@page import="com.baabtra.Service.LoginService"%> <%@page import="com.baabtra.Bean.RegistrationBean"%> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1“ %> <html> <head><title>User Profile</title></head><body> <% Integer ses_id=(Integer)session.getAttribute("login_id"); //here Integer is an object. int is converted to Integer object RegistrationBean objRegistrationBean = new RegistrationBean(); ProfileService objProfileService= new ProfileService(); objRegistrationBean = objProfileService.profileService(ses_id.intValue());//convert integer object back to int primitive data type String strUsername =objRegistrationBean.getStrUsername(); %> <h1>User Profile</h1> <table> <tr><td>User Name: </td><td><%=objRegistrationBean.getStrUsername()%></td></tr> <tr><td>Email: </td><td><%=objRegistrationBean.getStrEmail()%></td></tr> <tr><td>Gender: </td><td><%=objRegistrationBean.getStrGender()%></td></tr> <tr><td>Age: </td><td><%=objRegistrationBean.getStrDob()%></td></tr> </table></body> </html> Html page Scriplets Imports
  • 28. public RegistrationBean viewProfileDb(int loginId){ ConnectionDb objConn= new ConnectionDb(); Connection con=objConn.con; Statement st=(Statement)con.createStatement(); String sql="select vchr_username, vchr_email, vchr_gender, timestampdiff(year,dat_dob,current_date) as age from tbl_login join tbl_user on pk_int_loginid=fk_int_loginid where pk_int_loginid="+loginId+";"; ResultSet rs= st.executeQuery(sql); RegistrationBean user = new RegistrationBean(); /*Get data from db and set it to a bean object*/ while(rs.next()){ user.setStrUsername(rs.getString("vchr_username")); user.setStrEmail(rs.getString("vchr_email")); user.setStrGender(rs.getString("vchr_gender")); user.setStrDob(rs.getString("age")); } return user; } Fetching Data from database for the specified user
  • 29. The Combination Sites like Google, Amazon, Facebook etc. use both types of scripting: • server-side handles logging in, personal information and preferences and provides the specific data which the user wants (and allows new data to be stored) • client-side makes the page interactive, displaying or sorting data. • Can build efficient applications • Choice to do the processing in the most appropriate location • Choice where to keep up to date multi use data • Choose how to optimise the user experience: – Performance – Appearance – Function
  • 31. Want to learn more about programming or Looking to become a good programmer? Are you wasting time on searching so many contents online? Do you want to learn things quickly? Tired of spending huge amount of money to become a Software professional? Do an online course @ baabtra.com We put industry standards to practice. Our structured, activity based courses are so designed to make a quick, good software professional out of anybody who holds a passion for coding.
  • 32. Follow us @ twitter.com/baabtra Like us @ facebook.com/baabtra Subscribe to us @ youtube.com/baabtra Become a follower @ slideshare.net/BaabtraMentoringPartner Connect to us @ in.linkedin.com/in/baabtra Give a feedback @ massbaab.com/baabtra Thanks in advance www.baabtra.com | www.massbaab.com |www.baabte.com
  • 33. Contact Us Emarald Mall (Big Bazar Building) Mavoor Road, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 NC Complex, Near Bus Stand Mukkam, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 Cafit Square, Hilite Business Park, Near Pantheerankavu, Kozhikode Start up Village Eranakulam, Kerala, India. Email: info@baabtra.com