0% found this document useful (0 votes)
24 views7 pages

The World Wide Web Opened Up The Internet To Everyone

The document discusses various topics related to web development including the history and impact of the world wide web, HTML form inputs like password fields, event handling, dynamic HTML, Java servlets, reading and writing files in PHP, AngularJS filters, and popular web application frameworks.

Uploaded by

surya9965512212
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views7 pages

The World Wide Web Opened Up The Internet To Everyone

The document discusses various topics related to web development including the history and impact of the world wide web, HTML form inputs like password fields, event handling, dynamic HTML, Java servlets, reading and writing files in PHP, AngularJS filters, and popular web application frameworks.

Uploaded by

surya9965512212
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

1. The world wide web opened up the internet to everyone, 8.

An XML namespace is a collection of names


not just scientists. It connected the world in a way that
that can be used as element or attribute
made it much easier for people to get information, share,
and communicate. It has since allowed people to share names in an XML document. The namespace
their work and thoughts through social networking sites, qualifies element names uniquely on the Web in
blogs, video sharing, and more. order to avoid conflicts between elements with
2. the <input> tag by assigning password to the type attribute, to the same name.
take a password input in HTML form. It hides the character as
9. AngularJS:
soon as a we enter the characters of the password set. This is
Type: Front-end JavaScript framework.
also a single-line text input.
Purpose: Developed and maintained by Google,
Syntax AngularJS is a client-side framework for building
<form> dynamic web applications. It facilitates the
creation of single-page applications (SPAs)
<input type="password" name="name… " value=" ">Male
where a single HTML page is dynamically
</form> updated as the user interacts with the
application.
Language: It primarily uses JavaScript (and
optionally TypeScript), HTML, and CSS.
Features: AngularJS provides features like two-
way data binding, dependency injection, and a
modular architecture. It helps in organizing and
structuring the front-end code of web
3. An event is an action that occurs as per the user's
instruction as input and gives the output in response. We applications.
can consider different types of inputs, such as mouse Node.js:
clicks, button presses, and when users press tab and text Type: Server-side JavaScript runtime.
box change. Purpose: Node.js is designed to execute
4. DHTML stands for Dynamic Hypertext Markup language
JavaScript code on the server side. It allows
i.e., Dynamic HTML. Dynamic HTML is not a markup or
programming language but it is a term that combines the developers to build scalable network applications
features of various web development technologies for and is commonly used for building server-side
creating the web pages dynamic and interactive. components of web applications, APIs, and real-
5. GenericServlet:-
time applications.
-General for all protocol.
Language: JavaScript is the primary language
-Implements Servlet Interface.
-Use Service method. used in Node.js.
HttpServlet:- Features: Node.js is known for its event-driven,
-Only for HTTP Protocol. non-blocking I/O model, which makes it efficient
-Inherit GenericServlet class. and well-suited for handling a large number of
-Use doPost, doGet method instead of service simultaneous connections. It has a vast
method. ecosystem of packages available through npm
7. The program uses the file_put_contents function to write data to (Node Package Manager).
a file and the file_get_contents function to read data from the file.
10 .Currency Filter:
head> <title>PHP Script Create a .txt file & write  Format a number as a currency string.
content in it in PHP</title>  Example: {{ amount | currency }}
</head> <body> Date Filter:
<form action="" method="POST"> ...  Format a date object to a string based
<input type="submit" name="ok"/> ... on the provided format.
 Example: {{ dateObject | date:'yyyy-
<?
MM-dd HH:mm:ss' }}
{
Filter Filter:
if(fwrite($myfile,$txt) === false) //write a file. echo Select a subset of items from an array
"Error in writing!!!"; based on a criteria expression.
Example: ng-repeat="item in items | filter:searchText"
Number Filter:
Format a number as a string.
Example: {{ numberValue | number:2 }} (formats the number
with two decimal places)
Lowercase and Uppercase Filters:
Convert a string to lowercase or uppercase.
Example: {{ text | lowercase }} or {{ text | uppercase }}
LimitTo Filter:
Limits an array/string to a specified number of
elements/characters.
Example: {{ array | limitTo:5 }} (limits the array to the first 5
elements)
OrderBy Filter:
Orders an array by an expression or property.
Example: ng-repeat="item in items | orderBy:'propertyName'"
JSON Filter:
Formats an object as a JSON string.
Example: {{ object | json }}
Custom Filters:
You can also create custom filters by defining your own filter
function. This is useful when the built-in filters don't meet your
specific requirements.
There are numerous web application frameworks available for <div class="form-group">
building web applications in different programming languages. <label for="username">Username:</label>
Here's a list of some popular web application frameworks across <input type="text" class="form-control"
various languages: id="username" placeholder="Enter username"
required>
JavaScript/Node.js:
</div>
Express.js
<div class="form-group">
Koa.js
<label for="email">Email:</label>
Nest.js
<input type="email" class="form-control"
Python:
id="email" placeholder="Enter email" required>
Django
</div>
Flask
<div class="form-group">
Pyramid
<label for="password">Password:</label>
Ruby:
<input type="password" class="form-control"
Ruby on Rails (Rails)
id="password" placeholder="Enter password"
Java:
required>
Spring Boot
</div>
JavaServer Faces (JSF)
<button type="submit" class="btn btn-
Play Framework
primary">Submit</button>
PHP:
<button type="button" class="btn btn-secondary"
Laravel
onclick="resetForm()">Reset</button>
Symfony
</form>
CodeIgniter
</div>
Go:
Gin
<!-- Include Bootstrap JS and jQuery -->
Revel
<script src="https://code.jquery.com/jquery-
C#:
3.5.1.slim.min.js"></script>
ASP.NET Core
<script
Nancy
src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.
Now, let's create a simple registration form using HTML and
5.2/dist/umd/popper.min.js"></script>
JavaScript, and use the Bootstrap framework for styling. The form
<script
will include client-side validation using JavaScript. Please note that
src="https://stackpath.bootstrapcdn.com/bootstrap/4.
client-side validation is not sufficient for security, and server-side
5.2/js/bootstrap.min.js"></script>
validation is also necessary.

<!DOCTYPE html> <script>


<html lang="en"> function submitForm() {
<head> // Validate form data (client-side validation)
<meta charset="UTF-8"> var username =
<meta name="viewport" content="width=device-width, initial- document.getElementById('username').value;
scale=1.0"> var email =
<title>Registration Form</title> document.getElementById('email').value;
<!-- Include Bootstrap CSS --> var password =
<link rel="stylesheet" document.getElementById('password').value;
href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/boo
tstrap.min.css"> if (username.trim() === '' || email.trim() === '' ||
<style> password.trim() === '') {
/* Add custom styles here */ alert('All fields are required.');
</style> return;
</head> }
<body>
// Additional validation logic can be added here
<div class="container mt-5">
<h2>Registration Form</h2> // If validation passes, you can submit the form
<form id="registrationForm" data to the server or perform other actions
onsubmit="submitForm(); return false;"> alert('Form submitted successfully!');
// Reset the form after submission
resetForm();
}

function resetForm() {
// Reset form fields
document.getElementById('registrationForm').reset();
}
</script>
</body>
</html>
XML Schema (XSD) and Document Type Definition (DTD) are both <xs:element ref="book" minOccurs="0"
used for describing the structure and constraints maxOccurs="unbounded"/>
of XML
documents, but XML Schema has several advantages over DTDs. </xs:sequence>
Here are some advantages of XML Schema over DTDs: </xs:complexType>
</xs:element>
Strongly Typed:
</xs:schema>
XML Schema provides a way to define data types for elements
and attributes, allowing for stronger typing. This means you can In this example:
specify the expected data type for an element or attribute (e.g.,
string, integer, date), providing better validation and reducing the The schema defines a simple structure for a bookstore
chance of data errors. with books.
Namespace Support: The <xs:element> elements define elements like
"book" and "bookstore."
XML Schema supports XML namespaces, allowing you to define The <xs:complexType> elements define the structure
and enforce namespace-aware structures in XML documents. of complex types (e.g., the "book" type).
This is crucial for avoiding naming conflicts in complex XML The <xs:sequence> element specifies the order of child
documents. elements.
More Expressive: The type attribute specifies the data type of elements
(e.g., "xs:string" for strings, "xs:decimal" for decimal
XML Schema allows for more complex structures and numbers).
relationships between elements. It provides more expressive This XML Schema can be used to validate XML
content models, including the ability to specify minOccurs and documents to ensure they conform to the specified
maxOccurs for elements, making it more flexible than DTDs. structure and data types.
Facets and Constraints:

XML Schema provides facets and constraints that allow you to


specify additional rules for data values, such as minimum and
maximum values, regular expressions, and enumerations. This
enhances the validation capabilities of XML documents.
Bi-directional Relationships:

XML Schema supports the definition of bi-directional


relationships between elements, allowing you to define
relationships such as "one-to-many" and "many-to-many" more
explicitly.
<!-- Example XML Schema (bookstore.xsd) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<!-- Define the book element -->


<xs:element name="book">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="author" type="xs:string"/>
<xs:element name="price" type="xs:decimal"/>
</xs:sequence>
</xs:complexType>
</xs:element>

<!-- Define the bookstore element containing multiple books -->


<xs:element name="bookstore">
<xs:complexType>
<xs:sequence>
Loading a Servlet.
Initializing the Servlet.
Request handling.
Destroying the Servlet.
Let’s look at each of these stages in details:

Loading a Servlet: The first stage of the Servlet lifecycle


involves loading and initializing the Servlet by the
Servlet container. The Web container or Servlet
Container can load the Servlet at either of the
following two stages :
Initializing the context, on configuring the Servlet with
a zero or positive integer value.
If the Servlet is not preceding stage, it may delay the
loading process until the Web container determines
that this Servlet is needed to service a request.
Let’s look at each of these methods in details:
init() method: The Servlet.init() method is
called by the Servlet container to indicate that
Architecture Diagram this Servlet instance is instantiated
The following figure depicts a typical servlet life-cycle scenario. successfully and is about to put into service.
//init() method
First the HTTP requests coming to the server are delegated to the
servlet container.
public class MyServlet implements Servlet{
The servlet container loads the servlet before invoking the service() public void init(ServletConfig config) throws
method. ServletException {

Then the servlet container handles multiple requests by spawning //initialization code
multiple threads, each thread executing the service() method of a }
single instance of the servlet.
//rest of code
Lifecycle: }
service() method: The service() method of
the Servlet is invoked to inform the Servlet
about the client requests.
This method uses ServletRequest object to
collect the data requested by the client.
This method uses ServletResponse object to
generate the output content.
// service() method

public class MyServlet implements Servlet{


public void service(ServletRequest res,
The entire life cycle of a Servlet is managed by the Servlet container
ServletResponse res)
which uses the javax.servlet.Servlet interface to understand the
Servlet object and manage it. So, before creating a Servlet object, throws ServletException, IOException {
let’s first understand the life cycle of the Servlet object which is
actually understanding how the Servlet container manages the
// request handling code
Servlet object.

Stages of the Servlet Life Cycle: The Servlet life cycle mainly goes
through four stages,
destroy() method: The destroy() method runs only once
during the lifetime of a Servlet and signals the end of the
Servlet instance.
//destroy() method

public void destroy()


As soon as the destroy() method is
activated, the Servlet container
releases the Servlet instance.

You might also like