Download presentation
Presentation is loading. Please wait.
1
Servlets What is a Servlet?
Servlet can be described in many ways, depending on the context. Servlet is a technology i.e. used to create web application. Servlet is an API that provides many interfaces and classes including documentations. Servlet is an interface that must be implemented for creating any servlet. Servlet is a class that extend the capabilities of the servers and respond to the incoming request. It can respond to any type of requests. Servlet is a web component that is deployed on the server to create dynamic web page.
2
Servlet Architecture
3
FAQ for Servlets What is the web application and what is the difference between Get and Post request ? What information is received by the web server if we request for a servlet ? How to run servlet in Eclipse, MyEclipse and Netbeans IDE ? What are the ways for servlet collaboration and what is the difference between RequestDispatcher and sendRedirect() method ? What is the difference between ServletConfig and ServletContext interface? How many ways we can maintain state of an user ? Which approach is mostly used in web development ? How to count total number of visitors and total response time for a request using Filter ? How to run servlet with annotation ? How to create registration form using Servlet and Oracle database ? How can we upload and download file from the server ?
4
What is web application?
A web application is an application accessible from the web. A web application is composed of web components like Servlet, JSP, Filter etc. and other components such as HTML. The web components typically execute in Web Server and respond to HTTP request.
5
Example Programe JavaScript variables can contain single values: <!DOCTYPE html> <html> <body> <p>Creating a JavaScript Variable.</p> <p id="demo"></p> <script> var person = "John Doe"; document.getElementById("demo").innerHTML = person; </script> </body> </html> OUTPUT : Creating a JavaScript Variable. John Doe
6
Objects are variables too. But objects can contain many values
Objects are variables too. But objects can contain many values. The values are written as name : value pairs (name and value separated by a colon). <!DOCTYPE html> <html> <body> <p>Creating a JavaScript Object.</p> <p id="demo"></p> <script> var person = { firstName : "John", lastName : "Doe", age : 50, eyeColor : "blue" }; document.getElementById("demo").innerHTML = person.firstName + " " + person.lastName; </script> </body> </html> Output : Creating a JavaScript Object. John Doe 50
7
Event Handler An HTML event can be something the browser does, or something a user does. Here are some examples of HTML events: -> An HTML web page has finished loading -> An HTML input field was changed -> An HTML button was clicked Often, when events happen, you may want to do something.
8
HTML allows event handler attributes, with JavaScript code, to be added to HTML elements.
With single quotes: <some-HTML-element some-event='some JavaScript'> With double quotes: <some-HTML-element some-event="some JavaScript">
9
In the following example, an onclick attribute (with code), is added to a button element:
<!DOCTYPE html> <html> <body> <button onclick="document.getElementById('demo').innerHTML=Date()">The time is?</button> <p id="demo"></p> </body> </html> Output :
10
DHTML Three Important Concepts involved in DHTML JavaScript Alone
JavaScript and the HTML DOM JavaScript and HTML Events JavaScript and CSS
11
JavaScript Alone document.write() <html> <body>
<script type="text/javascript"> document.write(Date()); </script> </body> </html>
12
JavaScript and the HTML DOM
With HTML 4, JavaScript can also be used to change the inner content and attributes of HTML elements dynamically. To change the content of an HTML element use: document.getElementById(id).innerHTML=new HTML To change the attribute of an HTML element use: document.getElementById(id).attribute=new value
13
JavaScript and HTML Events
To execute code when a user clicks on an element, use the following event attribute: onclick=JavaScript
14
JavaScript and CSS To change the style of an HTML element use: document.getElementById(id).style.property=new style
15
Thank You,
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.