IAT 1 Bandal
IAT 1 Bandal
In the following example, we have used the inline CSS in <p> and <h1> tag.
1. <!DOCTYPE html>
2. <html>
3. <body style="background-color:white;">
4. <h1 style="color:Red;padding:20px;">CSS Tutorials</h1>
5. <p style="color:blue;">It will be useful here.</p>
6. </body>
7. </html>
Module 2
Although, JavaScript has no connectivity with Java programming language. The name
was suggested and provided in the times when Java was gaining popularity in the
market. In addition to web browsers, databases such as CouchDB and MongoDB uses
JavaScript as their scripting and query language.
Features of JavaScript
There are following features of JavaScript:
1. All popular web browsers support JavaScript as they provide built-in execution
environments.
2. JavaScript follows the syntax and structure of the C programming language. Thus, it is
a structured programming language.
3. JavaScript is a weakly typed language, where certain types are implicitly cast
(depending on the operation).
4. JavaScript is an object-oriented programming language that uses prototypes rather
than using classes for inheritance.
5. It is a light-weighted and interpreted language.
6. It is a case-sensitive language.
7. JavaScript is supportable in several operating systems including, Windows, macOS, etc.
8. It provides good control to the users over the web browsers.
Application of JavaScript
JavaScript is used to create interactive websites. It is mainly used for:
o Client-side validation,
o Dynamic drop-down menus,
o Displaying date and time,
o Displaying pop-up windows and dialog boxes (like an alert dialog box, confirm dialog
box and prompt dialog box),
o Displaying clocks etc.
JavaScript Example
1. <script>
2. document.write("Hello JavaScript by JavaScript");
3. </script>
Features of Javascript
Scripting
Javascript executes the client-side script in the browser.
Interpreter
The browser interprets JavaScript code.
Event Handling
Events are actions. Javascript provides event-handling options.
Light Weight
As Javascript is not a compiled language, source code never changes to byte code before
running time. Low-end devices can also run Javascript because of its lightweight feature.
Case Sensitive
In Javascript, names, variables, keywords, and functions are case-sensitive.
Control Statements
Javascript has control statements like if-else-if, switch case, and loop. Users can write complex
code using these control statements.
Objects as first-class Citizens
Javascript arrays, functions, and symbols are objects which can inherit the Object prototype
properties. Objects being first-class citizens means Objects can do all tasks.
Dynamic Typing
Javascript variables can have any value type. The same variable can have a string value, an
integer value, or any other.
Client-side Validations
Javascript client-side validations allow users to submit valid data to the server during a form
submission.
Platform Independent
Javascript will run in the same way in all systems with any operating system.
Async Processing
Javascript async-await and promise features provide asynchronous nature. As the processes
run in parallel, it improves processing time and responsiveness.
Prototype-based
Javascript follows 'Object.prototype' functions instead of class inheritance.
Features of JSON
o Simplicity
o Openness
o Self-Describing
o Internationalization
o Extensibility
o Interoperability
Why do we use JSON?
Since JSON is an easy-to-use, lightweight language data interchange format in
comparison to other available options, it can be used for API integration. Following are
the advantages of JSON:
o Less Verbose: In contrast to XML, JSON follows a compact style to improve its users'
readability. While working with a complex system, JSON tends to make substantial
enhancements.
o Faster: The JSON parsing process is faster than that of the XML because the DOM
manipulation library in XML requires extra memory for handling large XML files.
However, JSON requires less data that ultimately results in reducing the cost and
increasing the parsing speed.
o Readable: The JSON structure is easily readable and straightforward. Regardless of the
programming language that you are using, you can easily map the domain objects.
o Structured Data: In JSON, a map data structure is used, whereas XML follows a tree
structure. The key-value pairs limit the task but facilitate the predictive and easily
understandable model.
Module 3
1. Explain java servlet architecture
2. Explain lifecycle of servlet
3. What is servlet & explain adv
Servlet technology is used to create a web application (resides at server side and
generates a dynamic web page).
Servlet technology is robust and scalable because of java language. Before Servlet,
CGI (Common Gateway Interface) scripting language was common as a server-side
programming language. However, there were many disadvantages to this technology.
We have discussed these disadvantages below.
There are many interfaces and classes in the Servlet API such as Servlet, GenericServlet,
HttpServlet, ServletRequest, ServletResponse, etc.
What is a Servlet?
Servlet can be described in many ways, depending on the context.
There are many advantages of Servlet over CGI. The web container creates threads for
handling the multiple requests to the Servlet. Threads have many benefits over the
Processes such as they share a common memory area, lightweight, cost of
communication between the threads are low. The advantages of Servlet are as follows:
1. Better performance: because it creates a thread for each request, not process.
2. Portability: because it uses Java language.
3. Robust: JVM manages Servlets, so we don't need to worry about the memory
leak, garbage collection, etc.
4. Secure: because it uses java language.