You are on page 1of 10

IP 3,4,5 MODULES

1) Write a short note on servlet?


Ans:
1) Servlets are the Java programs that run on the Java-enabled web server or
application server.
2) They are used to handle the request obtained from the webserver,
3) Process the request, produce the response, then send a response back to the
webserver.
4) Servlets are portable and efficient
5) Servlets can directly communicate with the webserver.
6) Servlets can handle the cookies.
Properties of Servlets are as follows:
1) Servlets work on the server-side.
2) Servlets are capable of handling complex requests obtained from the
webserver.
2) Explain servlet lifecycle with diagram?
Ans:

Stages of the Servlet Life Cycle: The Servlet life cycle mainly goes through four
stages:
1) Loading a Servlet.
2) Initializing the Servlet.
3) Request handling.
4) Destroying the Servlet.

1) 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:
1) Loading : Loads the Servlet class.
2) Instantiation : Creates an instance of the Servlet.
2) Initializing a Servlet: After the Servlet is instantiated successfully, the
Servlet container initializes the instantiated Servlet object. The container
initializes the Servlet object by invoking the Servlet.init(ServletConfig)
method which accepts ServletConfig object reference as parameter.
3) Handling request: After initialization, the Servlet instance is ready to serve
the client requests.
4) After the destroy() method is executed, the Servlet container releases all the
references of this Servlet instance so that it becomes eligible for garbage
collection.
3) What is cookies in servlet explain with example?
Ans:
1) Cookie is a small piece of information that is persisted between the
multiple client requests.
2) It is Stored in key-value pair format to the client’s browser during multiple
requests.
3) When the client generates a request, the server gives the response with
cookies having an id which are then stored in the client’s browser.
4) To make a cookie, create an object of Cookie class and pass a name and its
value.
5) To fetch the cookie, getCookies() method of Request Interface is used.

4) Explain servlet architecture?


Ans:
1) Client: primarily working as a medium who is sending out HTTP
requests over to the web server and again processing the response it gets
back from the server.
2) Our client here is the web browser.
3) Web server: Primary job of a web server is to process the requests and
responses that a user sends over time and maintain how a web user
would be able to access the files
4) Web container: which is responsible for communicating with the
servlets. Two prime tasks of a web container are:

1) Managing the servlet lifecycle


2) URL mapping
5) Explain JSP with application?
Ans:
1) It stands for Java Server Pages.
2) It is a server side technology.
3) It is used for creating web application.
4) It is used to create dynamic web content.
5) In this JSP tags are used to insert JAVA code into HTML pages.
6) It is an advanced version of Servlet Technology.
Application of JSP:
1) Coding in JSP is easy :- As it is just adding JAVA code to HTML/XML.
2) Reduction in the length of Code :- In JSP we use action tags, custom tags
etc.
3) Connection to Database is easier :-It is easier to connect website to
database and allows to read or write data easily to the database.
4) Portable, Powerful, flexible and easy to maintain :- as these are browser
and server independent.
5) It is capable of handling exceptions
6) Difficult to debug for errors.

6) Give characteristics of RIA?


Ans:
• Performance – RIAs can often perform better than traditional applications on
the basis of the characteristics of network and applications
• Offline use – When connectivity is unavailable, it might still be possible to
use an RIA.
• Security – RIAs should be as secure as any other web application, and the.
Framework should be well equipped to enforce limitations
• Advanced Communications – Sophisticated communications with
supporting servers through optimized network protocols can considerably
enhance the user experience.
• Rapid Development - An RIA Framework should facilitate rapid development
of a rich user experience
7) Give an illustration of traditional web model versus Ajax web model?
Ans:

8) What is Ajax discuss the benefits of Ajax?


Ans:
1) AJAX stands for Asynchronous JavaScript and XML. AJAX is a new
technique for creating better, faster, and more interactive web applications
with the help of XML, HTML, CSS, and Java Script.
2) AJAX allows web applications to exchange data with the server
asynchronously without interfering with the display and presentation of the
web page,.
BENEFITS OF AJAX:
1) Quick response: It refreshes only a part of the web page that needs to be
changed or updated.
2) Asynchronous communication: It allows user to interact with the rest of
the web page while the application is processing the changed or update
part.
3) Browser support: it provides support to the widely used web browsers
like internet explorer, mozilla, firefox Etc
9)What is XML how it is different from HTML?
Ans:
XML ( Extensible markup language)
1) Xml is a markup language much like HTML.
2) The XML format was designed to store and transport data.
3) XML was designed as a self describing language

10) What are the benefits of using JSon over XML?


Ans:
11) Explain XML DOM?
Ans:
1) The XML DOM defines a standard way for accessing and manipulating
XML documents. It presents an XML document as a tree-structure.
2) The XML DOM is:
a) A standard object model for XML
b) A standard programming interface for XML
c) Platform- and language-independent
d) A W3C standard

12) Write a short note on XSL?


Ans:
1) XSL is a language for expressing style sheets.
2) File that describes how to display an XML document of a given type.
3) XSL shares the functionality and is compatible with CSS2
4) Advanced styling features, expressed by an XML document type which
defines a set of elements called Formatting
5) Styling requires a source XML documents, containing the information that the
style sheet will display
13) Write a Short note on PHP?
Ans:
1) PHP is an acronym for “PHP: Hypertext Preprocessor”
2) PHP is a widely-used, open source scripting language
3) PHP scripts are executed on the server
4) PHP is free to download and use.
5) PHP can generate dynamic page content
6) PHP can create, open, read, write, delete, and close files on the server
7) PHP can collect form data
8) PHP can send and receive cookies
9) PHP files can contain text, HTML, CSS, JavaScript, and PHP code
10) PHP code is executed on the server, and the result is returned to the
browser as plain HTML
11) PHP files have extension “.php”
12) PHP runs on various platforms (Windows, Linux, Unix, Mac OS X,
etc.)
14) List types of PHP operators and explain any 2?
Ans:
1) Arithmetic operators
2) Assignment operators
3) Comparison operators
4) Increment/Decrement operators
5) Logical operators
6) String operators
7) Array operators
8) Conditional assignment operators
Arithmetic operator:
1) Assignment operator:

You might also like