


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
The doccument covers both frontend languages and frameworks
Typology: Lecture notes
1 / 4
This page cannot be seen from the preview
Don't miss anything!
1. Why do we need XML?
XML, or Extensible Markup Language, is a text-based markup language that is used to describe and structure data in a way that is both human-readable and machine-readable. It is widely used for storing, transporting, and exchanging data because it is flexible, extensible, and self-describing. XML allows developers to define their own custom tags and attributes, making it well-suited for representing data in a variety of contexts and formats.
2. What is a DTD?
A DTD, or Document Type Definition, is a set of rules that defines the structure and content of an XML document. It specifies what elements can appear in the document, what attributes can be used, and what the relationships between elements and attributes should be. DTDs are used to validate the structure of an XML document and ensure that it conforms to a specific set of standards.
3. Why is the purpose of an XML parser?
The purpose of an XML parser is to read an XML document and interpret its content and structure. An XML parser takes an XML document as input and checks that it is well-formed and conforms to a specific DTD or schema. If the document is valid, the parser converts it into a data structure or object model that can be more easily accessed and manipulated by a program.
4. What is a deployment descriptor?
A deployment descriptor is a configuration file that defines the details of how a web application should be deployed and run on a server. It is typically an XML file that contains information about the web application's servlets, filters, listeners, and other components, as well as any initialization parameters or context settings that are required. The deployment descriptor is used by the server to configure and manage the web application at runtime.
5. List the phases of a servlet life cycle.
The phases of a servlet life cycle are:
Instantiation: the servlet is instantiated and its default constructor is called.
Initialization: the servlet's init() method is called to perform any required initialization.
Request handling: the servlet's service() method is called to process requests and generate responses.
Destruction: the servlet's destroy() method is called to perform any required cleanup before the servlet is unloaded.
6. What is the purpose of ServletConfig object?
The ServletConfig object is used to pass initialization parameters to a servlet. It is created by the server and passed to the servlet's init() method when the servlet is initialized. The ServletConfig object provides access to the servlet's initialization parameters and any other context information that the server wishes to provide to the servlet.
7. Why do we need a ServletContext object?
The ServletContext object is used to provide information about the runtime environment of a web application. It is created by the server and represents the web application as a whole, rather than a single servlet. The ServletContext object provides access to resources and information that are shared by all servlets in the web application, such as the web application's context path, deployment descriptor, and shared resources.
8. What are the methods available to read form parameters?
There are several methods available for reading form parameters in a servlet. Some examples include:
getParameter(name): returns the value of the specified form parameter as a String getParameterValues(name): returns an array of String values for the specified form parameter getParameterMap(): returns a Map of the form parameters and their values
9. What is a cookie?
A cookie is a small piece of data that is stored by a web browser on the user's computer. It is used to store information about the user's preferences or activities on a website, such as the user's login status or language preference. Cookies are typically sent by the server to the browser in the form of HTTP headers, and the browser sends them back to the server with each subsequent request.
10. List the various techniques available for session management.
There are several techniques available for managing sessions in web applications, including:
Cookies: cookies are used to store a unique session identifier that is sent back to the server with each request.
URL rewriting: session information is appended to the URL as a query string parameter, allowing the server to track the user's session.
Hidden form fields: session information is stored in hidden form fields and is sent back to the server when the form is submitted.
HTTP session: the server maintains a session object that is stored on the server and is associated with a unique session identifier. The session identifier is sent back to the server with each request in the form of a cookie or URL parameter.
11. What is uEL rewriting?
uEL rewriting is a technique for preserving session information in a web application when the client does not accept cookies. It works by appending the session information to the URL as a query string parameter, allowing the server to track the user's session even if cookies are not supported. uEL rewriting is often used in conjunction with other session management techniques to provide a fallback mechanism for users who do not accept cookies.
12. Explain the syntax of doGet method.
The doGet method is a method of the HttpServlet class that is used to handle HTTP GET requests. It has the following syntax:
A servlet is a Java class that is used to extend the capabilities of a web server. Servlets are typically used to process requests and generate responses for dynamic web content, such as HTML, XML, or JSON. They can be used to perform a wide range of tasks, such as handling form submissions, generating dynamic HTML pages, or interacting with databases. Servlets are executed on the server and are typically invoked by a web server or application container in response to an HTTP request.